Package org.htmlcleaner
Class TraversalDomSerializer
java.lang.Object
org.htmlcleaner.TraversalDomSerializer
A traversal-based serializer for DOM; used to avoid recursion and stack overflow for large
HTML documents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
Whether XML entities should be escaped or not.protected boolean
-
Constructor Summary
ConstructorsConstructorDescriptionTraversalDomSerializer
(CleanerProperties props, boolean escapeXml) TraversalDomSerializer
(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities) TraversalDomSerializer
(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities, boolean strictErrorChecking) -
Method Summary
-
Field Details
-
escapeXml
protected boolean escapeXmlWhether XML entities should be escaped or not. -
deserializeCdataEntities
protected boolean deserializeCdataEntities -
strictErrorChecking
protected boolean strictErrorChecking
-
-
Constructor Details
-
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
- Parameters:
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.escapeXml
- if true then escape XML entities
-
TraversalDomSerializer
- Parameters:
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.
-
-
Method Details
-
createDOM
- Parameters:
rootNode
- the HTML Cleaner root node to serialize- Returns:
- the W3C Document object
- Throws:
ParserConfigurationException
- if there's an error during serialization
-
toString
public static String toString(Document doc) throws TransformerException, ParserConfigurationException
-