Package nu.validator.htmlparser.dom
Class DOMTreeBuilder
- java.lang.Object
-
- nu.validator.htmlparser.impl.TreeBuilder<T>
-
- nu.validator.htmlparser.impl.CoalescingTreeBuilder<org.w3c.dom.Element>
-
- nu.validator.htmlparser.dom.DOMTreeBuilder
-
- All Implemented Interfaces:
TokenHandler,TreeBuilderState<org.w3c.dom.Element>
class DOMTreeBuilder extends CoalescingTreeBuilder<org.w3c.dom.Element>
The tree builder glue for building a tree through the public DOM APIs.- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description private org.w3c.dom.DocumentdocumentThe current doc.private org.w3c.dom.DOMImplementationimplementationThe DOM impl.-
Fields inherited from class nu.validator.htmlparser.impl.TreeBuilder
charBuffer, charBufferLen, errorHandler, tokenizer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDOMTreeBuilder(org.w3c.dom.DOMImplementation implementation)The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAttributesToElement(org.w3c.dom.Element element, HtmlAttributes attributes)protected voidappendCharacters(org.w3c.dom.Element parent, java.lang.String text)protected voidappendChildrenToNewParent(org.w3c.dom.Element oldParent, org.w3c.dom.Element newParent)protected voidappendComment(org.w3c.dom.Element parent, java.lang.String comment)protected voidappendCommentToDocument(java.lang.String comment)protected voidappendElement(org.w3c.dom.Element child, org.w3c.dom.Element newParent)protected org.w3c.dom.ElementcreateElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes)protected org.w3c.dom.ElementcreateElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes, org.w3c.dom.Element form)protected org.w3c.dom.ElementcreateHtmlElementSetAsRoot(HtmlAttributes attributes)protected voiddetachFromParent(org.w3c.dom.Element element)protected voiddocumentMode(DocumentMode mode, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)(package private) org.w3c.dom.DocumentgetDocument()Returns the document.(package private) org.w3c.dom.DocumentFragmentgetDocumentFragment()Return the document fragment.protected booleanhasChildren(org.w3c.dom.Element element)protected voidinsertFosterParentedCharacters(java.lang.String text, org.w3c.dom.Element table, org.w3c.dom.Element stackParent)protected voidinsertFosterParentedChild(org.w3c.dom.Element child, org.w3c.dom.Element table, org.w3c.dom.Element stackParent)protected voidstart(boolean fragment)-
Methods inherited from class nu.validator.htmlparser.impl.CoalescingTreeBuilder
accumulateCharacters, appendCharacters, appendComment, appendCommentToDocument, appendIsindexPrompt, insertFosterParentedCharacters
-
Methods inherited from class nu.validator.htmlparser.impl.TreeBuilder
appendDoctypeToDocument, cdataSectionAllowed, characters, comment, currentNode, doctype, elementPopped, elementPushed, end, endTag, endTokenization, eof, extractCharsetFromContent, fatal, fatal, flushCharacters, getDeepTreeSurrogateParent, getErrorHandler, getFormPointer, getHeadPointer, getListOfActiveFormattingElements, getListOfActiveFormattingElementsLength, getMode, getOriginalMode, getStack, getStackLength, isFramesetOk, isNeedToDropLF, isQuirks, isScriptingEnabled, loadState, markMalformedIfScript, newSnapshot, requestSuspension, setDoctypeExpectation, setDocumentModeHandler, setErrorHandler, setFragmentContext, setFragmentContext, setIgnoringComments, setNamePolicy, setReportingDoctype, setScriptingEnabled, snapshotMatches, startTag, startTokenization, wantsComments, zeroOriginatingReplacementCharacter
-
-
-
-
Method Detail
-
addAttributesToElement
protected void addAttributesToElement(org.w3c.dom.Element element, HtmlAttributes attributes) throws org.xml.sax.SAXException- Specified by:
addAttributesToElementin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.addAttributesToElement(java.lang.Object, nu.validator.htmlparser.impl.HtmlAttributes)
-
appendCharacters
protected void appendCharacters(org.w3c.dom.Element parent, java.lang.String text) throws org.xml.sax.SAXException- Specified by:
appendCharactersin classCoalescingTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
CoalescingTreeBuilder.appendCharacters(java.lang.Object, java.lang.String)
-
appendChildrenToNewParent
protected void appendChildrenToNewParent(org.w3c.dom.Element oldParent, org.w3c.dom.Element newParent) throws org.xml.sax.SAXException- Specified by:
appendChildrenToNewParentin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.appendChildrenToNewParent(java.lang.Object, java.lang.Object)
-
appendComment
protected void appendComment(org.w3c.dom.Element parent, java.lang.String comment) throws org.xml.sax.SAXException- Specified by:
appendCommentin classCoalescingTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
CoalescingTreeBuilder.appendComment(java.lang.Object, java.lang.String)
-
appendCommentToDocument
protected void appendCommentToDocument(java.lang.String comment) throws org.xml.sax.SAXException- Specified by:
appendCommentToDocumentin classCoalescingTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
CoalescingTreeBuilder.appendCommentToDocument(java.lang.String)
-
createElement
protected org.w3c.dom.Element createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes) throws org.xml.sax.SAXException- Specified by:
createElementin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.createElement(java.lang.String, java.lang.String, nu.validator.htmlparser.impl.HtmlAttributes)
-
createHtmlElementSetAsRoot
protected org.w3c.dom.Element createHtmlElementSetAsRoot(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Specified by:
createHtmlElementSetAsRootin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.createHtmlElementSetAsRoot(nu.validator.htmlparser.impl.HtmlAttributes)
-
appendElement
protected void appendElement(org.w3c.dom.Element child, org.w3c.dom.Element newParent) throws org.xml.sax.SAXException- Specified by:
appendElementin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.appendElement(java.lang.Object, java.lang.Object)
-
hasChildren
protected boolean hasChildren(org.w3c.dom.Element element) throws org.xml.sax.SAXException- Specified by:
hasChildrenin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.hasChildren(java.lang.Object)
-
createElement
protected org.w3c.dom.Element createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes, org.w3c.dom.Element form) throws org.xml.sax.SAXException- Overrides:
createElementin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.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 org.xml.sax.SAXException- Overrides:
startin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
nu.validator.htmlparser.impl.TreeBuilder#start()
-
documentMode
protected void documentMode(DocumentMode mode, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws org.xml.sax.SAXException
- Overrides:
documentModein classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.documentMode(nu.validator.htmlparser.common.DocumentMode, java.lang.String, java.lang.String, boolean)
-
getDocument
org.w3c.dom.Document getDocument()
Returns the document.- Returns:
- the document
-
getDocumentFragment
org.w3c.dom.DocumentFragment getDocumentFragment()
Return the document fragment.- Returns:
- the document fragment
-
insertFosterParentedCharacters
protected void insertFosterParentedCharacters(java.lang.String text, org.w3c.dom.Element table, org.w3c.dom.Element stackParent) throws org.xml.sax.SAXException- Specified by:
insertFosterParentedCharactersin classCoalescingTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException
-
insertFosterParentedChild
protected void insertFosterParentedChild(org.w3c.dom.Element child, org.w3c.dom.Element table, org.w3c.dom.Element stackParent) throws org.xml.sax.SAXException- Specified by:
insertFosterParentedChildin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException
-
detachFromParent
protected void detachFromParent(org.w3c.dom.Element element) throws org.xml.sax.SAXException- Specified by:
detachFromParentin classTreeBuilder<org.w3c.dom.Element>- Throws:
org.xml.sax.SAXException
-
-