org.htmlcleaner
Class DomSerializer

java.lang.Object
  extended by org.htmlcleaner.DomSerializer

public class DomSerializer
extends Object

DOM serializer - creates xml DOM.


Field Summary
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.
 
Constructor Summary
DomSerializer(CleanerProperties props)
           
DomSerializer(CleanerProperties props, boolean escapeXml)
           
 
Method Summary
 Document createDOM(TagNode rootNode)
           
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

props

protected CleanerProperties props
The HTML Cleaner properties set by the user to control the HTML cleaning.


escapeXml

protected boolean escapeXml
Whether XML entities should be escaped or not.

Constructor Detail

DomSerializer

public DomSerializer(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

DomSerializer

public DomSerializer(CleanerProperties props)
Parameters:
props - the HTML Cleaner properties set by the user to control the HTML cleaning.
Method Detail

createDOM

public Document createDOM(TagNode rootNode)
                   throws ParserConfigurationException
Parameters:
rootNode - the HTML Cleaner root node to serialize
Returns:
the W3C Document object
Throws:
ParserConfigurationException - if there's an error during serialization

isScriptOrStyle

protected boolean isScriptOrStyle(Element element)
Parameters:
element - the element to check
Returns:
true if the passed element is a script or style element

dontEscape

protected boolean dontEscape(Element element)
encapsulate content with <[CDATA[ ]]> for things like script and style elements

Parameters:
element -
Returns:
true if <[CDATA[ ]]> should be used.

outputCData

protected String outputCData(CData cdata)


Copyright © 2006-2014. All Rights Reserved.