nu.validator.htmlparser.dom
Class DOMTreeBuilder

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

 class DOMTreeBuilder
extends TreeBuilder<Element>


Field Summary
private  Document document
           
private  DOMImplementation implementation
           
 
Fields inherited from class nu.validator.htmlparser.impl.TreeBuilder
tokenizer
 
Constructor Summary
protected DOMTreeBuilder(DOMImplementation implementation)
           
 
Method Summary
protected  void addAttributesToElement(Element element, Attributes 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  Element createElement(String name, Attributes attributes)
           
protected  Element createElement(String name, Attributes attributes, Element form)
           
protected  Element createHtmlElementSetAsRoot(Attributes attributes)
           
protected  void detachFromParent(Element element)
           
protected  void detachFromParentAndAppendToNewParent(Element child, Element newParent)
           
protected  void documentMode(DocumentMode mode, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
           
(package private)  Document getDocument()
          Returns the document.
(package private)  DocumentFragment getDocumentFragment()
           
protected  boolean hasChildren(Element element)
           
protected  void insertBefore(Element child, Element sibling, Element parent)
           
protected  void insertCharactersBefore(char[] buf, int start, int length, Element sibling, Element parent)
           
protected  Element parentElementFor(Element child)
          Get the parent element.
protected  Element shallowClone(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

implementation

private DOMImplementation implementation

document

private Document document
Constructor Detail

DOMTreeBuilder

protected DOMTreeBuilder(DOMImplementation implementation)
Method Detail

addAttributesToElement

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

appendCharacters

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

appendChildrenToNewParent

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

appendComment

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

appendCommentToDocument

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

createElement

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

createHtmlElementSetAsRoot

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

detachFromParent

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

detachFromParentAndAppendToNewParent

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

hasChildren

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

insertBefore

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

insertCharactersBefore

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

parentElementFor

protected Element parentElementFor(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<Element>
Throws:
SAXException

shallowClone

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

getDocument

Document getDocument()
Returns the document.

Returns:
the document

getDocumentFragment

DocumentFragment getDocumentFragment()

createElement

protected Element createElement(String name,
                                Attributes attributes,
                                Element form)
                         throws SAXException
Overrides:
createElement in class TreeBuilder<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<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<Element>
Throws:
SAXException