Package org.htmlcleaner
Class XWikiDOMSerializer
- java.lang.Object
-
- org.htmlcleaner.DomSerializer
-
- org.htmlcleaner.XWikiDOMSerializer
-
public class XWikiDOMSerializer extends org.htmlcleaner.DomSerializer
Generate 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 theorg.htmlcleaner
package because we use the following package protected API: TagNode#getNamespaceURIOnPath(String).- Since:
- 1.8.2
- Version:
- $Id: d54eedb46a3e899afd978864d1849ccc2c25202c $
-
-
Constructor Summary
Constructors Constructor Description XWikiDOMSerializer(org.htmlcleaner.CleanerProperties props)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Document
createDOM(DocumentBuilder documentBuilder, org.htmlcleaner.TagNode rootNode)
Create the DOM given a rootNode and a document builder.
-
-
-
Method Detail
-
createDOM
public Document createDOM(DocumentBuilder documentBuilder, org.htmlcleaner.TagNode rootNode) throws ParserConfigurationException
Create the DOM given a rootNode and a document builder. This method is a replica ofDomSerializer.createDOM(TagNode)
excepts that it requires to give a DocumentBuilder.- Parameters:
documentBuilder
- theDocumentBuilder
instance to use, DocumentBuilder is not guaranteed to be thread safe so at most the safe instance should be used only in the same threadrootNode
- the HTML Cleaner root node to serialize- Returns:
- the W3C Document object
- Throws:
ParserConfigurationException
- if there's an error during serialization
-
-