public class XWikiDOMSerializer extends org.htmlcleaner.DomSerializerGenerate a W3C Document from a SF's HTML Cleaner TagNode. Some code has been copy-pasted from SF's HTML Cleaner code (which is under a BDS license, see http://htmlcleaner.sourceforge.net/license.php). Our goal is to remove this class completely if we can get SF's HTML Cleaner to support the usage of a dedicated builder. Here's the reason why we want to be able to give a dedicated builder: Note that creating the DocumentBuilder is not super fast but it's specifically more about the DocumentBuilderFactory creation mainly because it's blocking all the threads which are doing stuff implying loading a class from the classloader making it an important lock contention. I modified its behavior (and other similar tasks) after noticing that there was often a bunch of threads waiting for this kind of lock. Note: Even though in a public package this code is not meant to be a public API. We've had to put in under the
org.htmlcleanerpackage because we use the following package protected API: TagNode#getNamespaceURIOnPath(String).
- $Id: d54eedb46a3e899afd978864d1849ccc2c25202c $
Constructors Constructor Description
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
createDOM(DocumentBuilder documentBuilder, org.htmlcleaner.TagNode rootNode)Create the DOM given a rootNode and a document builder.
Methods inherited from class org.htmlcleaner.DomSerializer
createDocument, createDOM, createSubnodes, deserializeCdataEntities, dontEscape, isScriptOrStyle, outputCData
public Document createDOM(DocumentBuilder documentBuilder, org.htmlcleaner.TagNode rootNode) throws ParserConfigurationExceptionCreate the DOM given a rootNode and a document builder. This method is a replica of
DomSerializer.createDOM(TagNode)excepts that it requires to give a DocumentBuilder.
DocumentBuilderinstance to use, DocumentBuilder is not guaranteed to be thread safe so at most the safe instance should be used only in the same thread
rootNode- the HTML Cleaner root node to serialize
- the W3C Document object
ParserConfigurationException- if there's an error during serialization