nu.validator.htmlparser.xom
Class XOMTreeBuilder

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

 class XOMTreeBuilder
extends CoalescingTreeBuilder<nu.xom.Element>


Field Summary
private  nu.xom.Element cachedTable
           
private  int cachedTableIndex
           
private  nu.xom.Document document
           
private  SimpleNodeFactory nodeFactory
           
 
Fields inherited from class nu.validator.htmlparser.impl.TreeBuilder
charBuffer, charBufferLen, errorHandler, tokenizer
 
Constructor Summary
protected XOMTreeBuilder(SimpleNodeFactory nodeFactory)
           
 
Method Summary
protected  void addAttributesToElement(nu.xom.Element element, HtmlAttributes attributes)
           
protected  void appendCharacters(nu.xom.Element parent, String text)
           
protected  void appendChildrenToNewParent(nu.xom.Element oldParent, nu.xom.Element newParent)
           
protected  void appendComment(nu.xom.Element parent, String comment)
           
protected  void appendCommentToDocument(String comment)
           
protected  void appendElement(nu.xom.Element child, nu.xom.Element newParent)
           
protected  nu.xom.Element createElement(String ns, String name, HtmlAttributes attributes)
           
protected  nu.xom.Element createElement(String ns, String name, HtmlAttributes attributes, nu.xom.Element form)
           
protected  nu.xom.Element createHtmlElementSetAsRoot(HtmlAttributes attributes)
           
protected  void detachFromParent(nu.xom.Element element)
           
protected  void documentMode(DocumentMode mode, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
           
protected  void end()
           
(package private)  nu.xom.Document getDocument()
          Returns the document.
(package private)  nu.xom.Nodes getDocumentFragment()
           
protected  boolean hasChildren(nu.xom.Element element)
           
private  int indexOfTable(nu.xom.Element table, nu.xom.Element stackParent)
           
protected  void insertFosterParentedCharacters(String text, nu.xom.Element table, nu.xom.Element stackParent)
           
protected  void insertFosterParentedChild(nu.xom.Element child, nu.xom.Element table, nu.xom.Element stackParent)
           
protected  nu.xom.Element shallowClone(nu.xom.Element element)
           
protected  void start(boolean fragment)
           
 
Methods inherited from class nu.validator.htmlparser.impl.CoalescingTreeBuilder
accumulateCharacters, appendCharacters, appendComment, appendCommentToDocument, insertFosterParentedCharacters
 
Methods inherited from class nu.validator.htmlparser.impl.TreeBuilder
accumulateCharacter, appendDoctypeToDocument, characters, comment, currentNode, doctype, elementPopped, elementPushed, endTag, endTokenization, eof, extractCharsetFromContent, fatal, fatal, getErrorHandler, inForeign, isScriptingEnabled, requestSuspension, setDoctypeExpectation, setDocumentModeHandler, setErrorHandler, setFragmentContext, setFragmentContext, setIgnoringComments, setNamePolicy, setReportingDoctype, setScriptingEnabled, startTag, startTokenization, wantsComments
 
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

cachedTableIndex

private int cachedTableIndex

cachedTable

private nu.xom.Element cachedTable
Constructor Detail

XOMTreeBuilder

protected XOMTreeBuilder(SimpleNodeFactory nodeFactory)
Method Detail

addAttributesToElement

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

appendCharacters

protected void appendCharacters(nu.xom.Element parent,
                                String text)
                         throws SAXException
Specified by:
appendCharacters in class CoalescingTreeBuilder<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,
                             String comment)
                      throws SAXException
Specified by:
appendComment in class CoalescingTreeBuilder<nu.xom.Element>
Throws:
SAXException

appendCommentToDocument

protected void appendCommentToDocument(String comment)
                                throws SAXException
Specified by:
appendCommentToDocument in class CoalescingTreeBuilder<nu.xom.Element>
Throws:
SAXException

createElement

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

createHtmlElementSetAsRoot

protected nu.xom.Element createHtmlElementSetAsRoot(HtmlAttributes 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

appendElement

protected void appendElement(nu.xom.Element child,
                             nu.xom.Element newParent)
                      throws SAXException
Specified by:
appendElement 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

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 ns,
                                       String name,
                                       HtmlAttributes attributes,
                                       nu.xom.Element form)
                                throws SAXException
Overrides:
createElement in class TreeBuilder<nu.xom.Element>
Throws:
SAXException
See Also:
nu.validator.htmlparser.impl.TreeBuilder#createElement(String, 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)

insertFosterParentedCharacters

protected void insertFosterParentedCharacters(String text,
                                              nu.xom.Element table,
                                              nu.xom.Element stackParent)
                                       throws SAXException
Specified by:
insertFosterParentedCharacters in class CoalescingTreeBuilder<nu.xom.Element>
Throws:
SAXException

insertFosterParentedChild

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

indexOfTable

private int indexOfTable(nu.xom.Element table,
                         nu.xom.Element stackParent)

end

protected void end()
            throws SAXException
Overrides:
end in class TreeBuilder<nu.xom.Element>
Throws:
SAXException
See Also:
TreeBuilder.end()