nu.validator.htmlparser.sax
Class SAXTreeBuilder

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

 class SAXTreeBuilder
extends TreeBuilder<Element>


Field Summary
private  Node cachedTable
           
private  Node cachedTablePreviousSibling
           
private  Document document
           
 
Fields inherited from class nu.validator.htmlparser.impl.TreeBuilder
charBuffer, charBufferLen, errorHandler, tokenizer
 
Constructor Summary
SAXTreeBuilder()
           
 
Method Summary
protected  void addAttributesToElement(Element element, HtmlAttributes attributes)
           
protected  void appendCharacters(Element parent, char[] buf, int start, int length)
           
protected  void appendChildrenToNewParent(Element oldParent, Element newParent)
           
protected  void appendComment(Element parent, char[] buf, int start, int length)
           
protected  void appendCommentToDocument(char[] buf, int start, int length)
           
protected  void appendDoctypeToDocument(String name, String publicIdentifier, String systemIdentifier)
           
protected  void appendElement(Element child, Element newParent)
           
protected  Element createElement(String ns, String name, HtmlAttributes attributes)
           
protected  Element createHtmlElementSetAsRoot(HtmlAttributes attributes)
           
protected  void detachFromParent(Element element)
           
protected  void end()
           
(package private)  Document getDocument()
          Returns the document.
(package private)  DocumentFragment getDocumentFragment()
           
protected  boolean hasChildren(Element element)
           
protected  void insertFosterParentedCharacters(char[] buf, int start, int length, Element table, Element stackParent)
           
protected  void insertFosterParentedChild(Element child, Element table, Element stackParent)
           
private  Node previousSibling(Node table)
           
protected  Element shallowClone(Element element)
           
protected  void start(boolean fragment)
           
 
Methods inherited from class nu.validator.htmlparser.impl.TreeBuilder
accumulateCharacter, accumulateCharacters, characters, comment, createElement, currentNode, doctype, documentMode, 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

document

private Document document

cachedTable

private Node cachedTable

cachedTablePreviousSibling

private Node cachedTablePreviousSibling
Constructor Detail

SAXTreeBuilder

SAXTreeBuilder()
Method Detail

appendComment

protected void appendComment(Element parent,
                             char[] buf,
                             int start,
                             int length)
Specified by:
appendComment in class TreeBuilder<Element>

appendCommentToDocument

protected void appendCommentToDocument(char[] buf,
                                       int start,
                                       int length)
Specified by:
appendCommentToDocument in class TreeBuilder<Element>

appendCharacters

protected void appendCharacters(Element parent,
                                char[] buf,
                                int start,
                                int length)
Specified by:
appendCharacters in class TreeBuilder<Element>

hasChildren

protected boolean hasChildren(Element element)
Specified by:
hasChildren in class TreeBuilder<Element>

shallowClone

protected Element shallowClone(Element element)
Specified by:
shallowClone in class TreeBuilder<Element>

appendElement

protected void appendElement(Element child,
                             Element newParent)
Specified by:
appendElement in class TreeBuilder<Element>

createHtmlElementSetAsRoot

protected Element createHtmlElementSetAsRoot(HtmlAttributes attributes)
Specified by:
createHtmlElementSetAsRoot in class TreeBuilder<Element>

addAttributesToElement

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

appendDoctypeToDocument

protected void appendDoctypeToDocument(String name,
                                       String publicIdentifier,
                                       String systemIdentifier)
Overrides:
appendDoctypeToDocument in class TreeBuilder<Element>
See Also:
TreeBuilder.appendDoctypeToDocument(java.lang.String, java.lang.String, java.lang.String)

getDocument

Document getDocument()
Returns the document.

Returns:
the document

getDocumentFragment

DocumentFragment getDocumentFragment()

end

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

start

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

appendChildrenToNewParent

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

createElement

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

insertFosterParentedCharacters

protected void insertFosterParentedCharacters(char[] buf,
                                              int start,
                                              int length,
                                              Element table,
                                              Element stackParent)
                                       throws SAXException
Specified by:
insertFosterParentedCharacters in class TreeBuilder<Element>
Throws:
SAXException

insertFosterParentedChild

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

previousSibling

private Node previousSibling(Node table)

detachFromParent

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