Package org.htmlcleaner
Class DomBuilder
- java.lang.Object
-
- org.htmlcleaner.DomBuilder
-
- All Implemented Interfaces:
XmlVisitor
public class DomBuilder extends java.lang.Object implements XmlVisitor
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCSS_COMMENT_STARTprotected booleandeserializeCdataEntitiesprivate org.w3c.dom.ElementdestinationElementprivate org.w3c.dom.Documentdocumentprotected booleanescapeXmlprivate CleanerPropertiespropsprotected booleanstrictErrorChecking
-
Constructor Summary
Constructors Constructor Description DomBuilder(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities, boolean strictErrorChecking)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.w3c.dom.DocumentcreateDocument(TagNode rootNode)protected java.lang.StringdeserializeCdataEntities(java.lang.String input)org.w3c.dom.DocumentgetDocument()voidhead(HtmlNode node, int depth)Callback for when a node is first visited.private booleanshouldEscapeOrTranslateEntities()voidtail(HtmlNode node, int depth)Callback for when a node is last visited, after all of its descendants have been visited.
-
-
-
Field Detail
-
document
private org.w3c.dom.Document document
-
destinationElement
private org.w3c.dom.Element destinationElement
-
props
private CleanerProperties props
-
escapeXml
protected boolean escapeXml
-
deserializeCdataEntities
protected boolean deserializeCdataEntities
-
strictErrorChecking
protected boolean strictErrorChecking
-
CSS_COMMENT_START
private static final java.lang.String CSS_COMMENT_START
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DomBuilder
public DomBuilder(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities, boolean strictErrorChecking)
-
-
Method Detail
-
getDocument
public org.w3c.dom.Document getDocument()
-
shouldEscapeOrTranslateEntities
private boolean shouldEscapeOrTranslateEntities()
-
head
public void head(HtmlNode node, int depth)
Description copied from interface:XmlVisitorCallback for when a node is first visited.- Specified by:
headin interfaceXmlVisitor- Parameters:
node- the node being visited.depth- the depth of the node, relative to the root node. E.g., the root node has depth 0, and a child node of that will have depth 1.
-
deserializeCdataEntities
protected java.lang.String deserializeCdataEntities(java.lang.String input)
-
tail
public void tail(HtmlNode node, int depth)
Description copied from interface:XmlVisitorCallback for when a node is last visited, after all of its descendants have been visited.- Specified by:
tailin interfaceXmlVisitor- Parameters:
node- the node being visited.depth- the depth of the node, relative to the root node. E.g., the root node has depth 0, and a child node of that will have depth 1.
-
createDocument
protected org.w3c.dom.Document createDocument(TagNode rootNode) throws javax.xml.parsers.ParserConfigurationException
- Throws:
javax.xml.parsers.ParserConfigurationException
-
-