nu.validator.htmlparser.xom
Class XOMTreeBuilder

java.lang.Object
  extended by nu.validator.htmlparser.impl.TreeBuilder<nu.xom.Element>
      extended by nu.validator.htmlparser.xom.XOMTreeBuilder
All Implemented Interfaces:
TokenHandler

 class XOMTreeBuilder
extends TreeBuilder<nu.xom.Element>


Field Summary
private  nu.xom.Document document
           
private  SimpleNodeFactory nodeFactory
           
 
Fields inherited from class nu.validator.htmlparser.impl.TreeBuilder
tokenizer
 
Constructor Summary
protected XOMTreeBuilder(SimpleNodeFactory nodeFactory)
           
 
Method Summary
protected  void addAttributesToElement(nu.xom.Element element, Attributes attributes)
           
protected  void appendCharacters(nu.xom.Element parent, char[] buf, int start, int length)
           
protected  void appendChildrenToNewParent(nu.xom.Element oldParent, nu.xom.Element newParent)
           
protected  void appendComment(nu.xom.Element parent, char[] buf, int start, int length)
           
protected  void appendCommentToDocument(char[] buf, int start, int length)
           
protected  nu.xom.Element createElement(String name, Attributes attributes)
           
protected  nu.xom.Element createElement(String name, Attributes attributes, nu.xom.Element form)
           
protected  nu.xom.Element createHtmlElementSetAsRoot(Attributes attributes)
           
protected  void detachFromParent(nu.xom.Element element)
           
protected  void detachFromParentAndAppendToNewParent(nu.xom.Element child, nu.xom.Element newParent)
           
protected  void documentMode(DocumentMode mode, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
           
(package private)  nu.xom.Document getDocument()
          Returns the document.
(package private)  nu.xom.Nodes getDocumentFragment()
           
protected  boolean hasChildren(nu.xom.Element element)
           
protected  void insertBefore(nu.xom.Element child, nu.xom.Element sibling, nu.xom.Element parent)
           
protected  void insertCharactersBefore(char[] buf, int start, int length, nu.xom.Element sibling, nu.xom.Element parent)
           
protected  nu.xom.Element parentElementFor(nu.xom.Element child)
          Get the parent element.
protected  nu.xom.Element shallowClone(nu.xom.Element element)
           
protected  void start(boolean fragment)
           
 
Methods inherited from class nu.validator.htmlparser.impl.TreeBuilder
appendDoctypeToDocument, bodyClosed, characters, comment, currentNode, doctype, elementPopped, elementPushed, end, endTag, eof, err, fatal, fatal, htmlClosed, isScriptingEnabled, setDoctypeExpectation, setDocumentModeHandler, setErrorHandler, setFragmentContext, setIgnoringComments, setReportingDoctype, setScriptingEnabled, start, startTag, wantsComments, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeFactory

private final SimpleNodeFactory nodeFactory

document

private nu.xom.Document document
Constructor Detail

XOMTreeBuilder

protected XOMTreeBuilder(SimpleNodeFactory nodeFactory)
Method Detail

addAttributesToElement

protected void addAttributesToElement(nu.xom.Element element,
                                      Attributes attributes)
                               throws SAXException
Specified by:
addAttributesToElement in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

appendCharacters

protected void appendCharacters(nu.xom.Element parent,
                                char[] buf,
                                int start,
                                int length)
                         throws SAXException
Specified by:
appendCharacters in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

appendChildrenToNewParent

protected void appendChildrenToNewParent(nu.xom.Element oldParent,
                                         nu.xom.Element newParent)
                                  throws SAXException
Specified by:
appendChildrenToNewParent in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

appendComment

protected void appendComment(nu.xom.Element parent,
                             char[] buf,
                             int start,
                             int length)
                      throws SAXException
Specified by:
appendComment in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

appendCommentToDocument

protected void appendCommentToDocument(char[] buf,
                                       int start,
                                       int length)
                                throws SAXException
Specified by:
appendCommentToDocument in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

createElement

protected nu.xom.Element createElement(String name,
                                       Attributes attributes)
                                throws SAXException
Specified by:
createElement in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

createHtmlElementSetAsRoot

protected nu.xom.Element createHtmlElementSetAsRoot(Attributes attributes)
                                             throws SAXException
Specified by:
createHtmlElementSetAsRoot in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

detachFromParent

protected void detachFromParent(nu.xom.Element element)
                         throws SAXException
Specified by:
detachFromParent in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

detachFromParentAndAppendToNewParent

protected void detachFromParentAndAppendToNewParent(nu.xom.Element child,
                                                    nu.xom.Element newParent)
                                             throws SAXException
Specified by:
detachFromParentAndAppendToNewParent in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

hasChildren

protected boolean hasChildren(nu.xom.Element element)
                       throws SAXException
Specified by:
hasChildren in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

insertBefore

protected void insertBefore(nu.xom.Element child,
                            nu.xom.Element sibling,
                            nu.xom.Element parent)
                     throws SAXException
Specified by:
insertBefore in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

insertCharactersBefore

protected void insertCharactersBefore(char[] buf,
                                      int start,
                                      int length,
                                      nu.xom.Element sibling,
                                      nu.xom.Element parent)
                               throws SAXException
Specified by:
insertCharactersBefore in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

parentElementFor

protected nu.xom.Element parentElementFor(nu.xom.Element child)
                                   throws SAXException
Description copied from class: TreeBuilder
Get the parent element. MUST return null if there is no parent or the parent is not an element.

Specified by:
parentElementFor in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

shallowClone

protected nu.xom.Element shallowClone(nu.xom.Element element)
                               throws SAXException
Specified by:
shallowClone in class TreeBuilder<nu.xom.Element>
Throws:
SAXException

getDocument

nu.xom.Document getDocument()
Returns the document.

Returns:
the document

getDocumentFragment

nu.xom.Nodes getDocumentFragment()

createElement

protected nu.xom.Element createElement(String name,
                                       Attributes attributes,
                                       nu.xom.Element form)
                                throws SAXException
Overrides:
createElement in class TreeBuilder<nu.xom.Element>
Throws:
SAXException
See Also:
TreeBuilder.createElement(java.lang.String, org.xml.sax.Attributes, java.lang.Object)

start

protected void start(boolean fragment)
              throws SAXException
Overrides:
start in class TreeBuilder<nu.xom.Element>
Throws:
SAXException
See Also:
nu.validator.htmlparser.impl.TreeBuilder#start()

documentMode

protected void documentMode(DocumentMode mode,
                            String publicIdentifier,
                            String systemIdentifier,
                            boolean html4SpecificAdditionalErrorChecks)
                     throws SAXException
Overrides:
documentMode in class TreeBuilder<nu.xom.Element>
Throws:
SAXException
See Also:
TreeBuilder.documentMode(nu.validator.htmlparser.common.DocumentMode, java.lang.String, java.lang.String, boolean)