public class DomSerializer extends Object
DOM serializer - creates xml DOM.
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
deserializeCdataEntities |
|
protected boolean |
escapeXml |
Whether XML entities should be escaped or not.
|
protected CleanerProperties |
props |
The HTML Cleaner properties set by the user to control the HTML cleaning.
|
protected boolean |
strictErrorChecking |
Constructor | Description |
---|---|
DomSerializer(CleanerProperties props) |
|
DomSerializer(CleanerProperties props,
boolean escapeXml) |
|
DomSerializer(CleanerProperties props,
boolean escapeXml,
boolean deserializeCdataEntities) |
|
DomSerializer(CleanerProperties props,
boolean escapeXml,
boolean deserializeCdataEntities,
boolean strictErrorChecking) |
Modifier and Type | Method | Description |
---|---|---|
protected Document |
createDocument(TagNode rootNode) |
|
Document |
createDOM(TagNode rootNode) |
|
protected void |
createSubnodes(Document document,
Element element,
List<? extends BaseToken> tagChildren) |
Serialize a given HTML Cleaner node.
|
protected String |
deserializeCdataEntities(String input) |
|
protected boolean |
dontEscape(Element element) |
encapsulate content with <[CDATA[ ]]> for things like script and style elements
|
protected boolean |
isScriptOrStyle(Element element) |
|
protected String |
outputCData(CData cdata) |
protected CleanerProperties props
protected boolean escapeXml
protected boolean deserializeCdataEntities
protected boolean strictErrorChecking
public DomSerializer(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities, boolean strictErrorChecking)
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 offpublic DomSerializer(CleanerProperties props, boolean escapeXml, boolean deserializeCdataEntities)
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 sectionspublic DomSerializer(CleanerProperties props, boolean escapeXml)
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.escapeXml
- if true then escape XML entitiespublic DomSerializer(CleanerProperties props)
props
- the HTML Cleaner properties set by the user to control the HTML cleaning.protected Document createDocument(TagNode rootNode) throws ParserConfigurationException
ParserConfigurationException
public Document createDOM(TagNode rootNode) throws ParserConfigurationException
rootNode
- the HTML Cleaner root node to serializeParserConfigurationException
- if there's an error during serializationprotected boolean isScriptOrStyle(Element element)
element
- the element to checkprotected boolean dontEscape(Element element)
element
- protected void createSubnodes(Document document, Element element, List<? extends BaseToken> tagChildren)
document
- the W3C Document to use for creating new DOM elementselement
- the W3C element to which we'll add the subnodes totagChildren
- the HTML Cleaner nodes to serialize for that nodeCopyright © 2006–2018. All rights reserved.