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.String
CSS_COMMENT_START
protected boolean
deserializeCdataEntities
private org.w3c.dom.Element
destinationElement
private org.w3c.dom.Document
document
protected boolean
escapeXml
private CleanerProperties
props
protected boolean
strictErrorChecking
-
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.Document
createDocument(TagNode rootNode)
protected java.lang.String
deserializeCdataEntities(java.lang.String input)
org.w3c.dom.Document
getDocument()
void
head(HtmlNode node, int depth)
Callback for when a node is first visited.private boolean
shouldEscapeOrTranslateEntities()
void
tail(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:XmlVisitor
Callback for when a node is first visited.- Specified by:
head
in 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:XmlVisitor
Callback for when a node is last visited, after all of its descendants have been visited.- Specified by:
tail
in 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
-
-