Package org.htmlcleaner
Class TraversalDomSerializer
- java.lang.Object
-
- org.htmlcleaner.TraversalDomSerializer
-
public class TraversalDomSerializer extends java.lang.Object
A traversal-based serializer for DOM; used to avoid recursion and stack overflow for large HTML documents.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
deserializeCdataEntities
protected boolean
escapeXml
Whether XML entities should be escaped or not.protected boolean
strictErrorChecking
-
Constructor Summary
Constructors Constructor Description TraversalDomSerializer(CleanerProperties props)
TraversalDomSerializer(CleanerProperties props, boolean escapeXml)
TraversalDomSerializer(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities)
TraversalDomSerializer(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities, boolean strictErrorChecking)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.Document
createDOM(TagNode rootNode)
static java.lang.String
toString(org.w3c.dom.Document doc)
-
-
-
Constructor Detail
-
TraversalDomSerializer
public TraversalDomSerializer(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities, boolean strictErrorChecking)
- Parameters:
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.escapeXml
- if true then escape XML entitiesdeserializeCdataEntities
- if true then deserialize entities in CData sectionsstrictErrorChecking
- if false then Document strict error checking is turned off
-
TraversalDomSerializer
public TraversalDomSerializer(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities)
- Parameters:
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.escapeXml
- if true then escape XML entitiesdeserializeCdataEntities
- if true then deserialize entities in CData sections
-
TraversalDomSerializer
public TraversalDomSerializer(CleanerProperties props, boolean escapeXml)
- Parameters:
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.escapeXml
- if true then escape XML entities
-
TraversalDomSerializer
public TraversalDomSerializer(CleanerProperties props)
- Parameters:
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.
-
-
Method Detail
-
createDOM
public org.w3c.dom.Document createDOM(TagNode rootNode) throws javax.xml.parsers.ParserConfigurationException
- Parameters:
rootNode
- the HTML Cleaner root node to serialize- Returns:
- the W3C Document object
- Throws:
javax.xml.parsers.ParserConfigurationException
- if there's an error during serialization
-
toString
public static java.lang.String toString(org.w3c.dom.Document doc) throws javax.xml.transform.TransformerException, javax.xml.parsers.ParserConfigurationException
- Throws:
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException
-
-