Package nu.validator.htmlparser.xom
Class XOMTreeBuilder
- java.lang.Object
-
- nu.validator.htmlparser.impl.TreeBuilder<T>
-
- nu.validator.htmlparser.impl.CoalescingTreeBuilder<nu.xom.Element>
-
- nu.validator.htmlparser.xom.XOMTreeBuilder
-
- All Implemented Interfaces:
TokenHandler
,TreeBuilderState<nu.xom.Element>
class XOMTreeBuilder extends CoalescingTreeBuilder<nu.xom.Element>
-
-
Field Summary
Fields Modifier and Type Field Description 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
Constructors Modifier Constructor Description protected
XOMTreeBuilder(SimpleNodeFactory nodeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAttributesToElement(nu.xom.Element element, HtmlAttributes attributes)
protected void
appendCharacters(nu.xom.Element parent, java.lang.String text)
protected void
appendChildrenToNewParent(nu.xom.Element oldParent, nu.xom.Element newParent)
protected void
appendComment(nu.xom.Element parent, java.lang.String comment)
protected void
appendCommentToDocument(java.lang.String comment)
protected void
appendElement(nu.xom.Element child, nu.xom.Element newParent)
protected nu.xom.Element
createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes)
protected nu.xom.Element
createElement(java.lang.String ns, java.lang.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, java.lang.String publicIdentifier, java.lang.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(java.lang.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 void
start(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, 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
-
-
-
-
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 org.xml.sax.SAXException
- Specified by:
addAttributesToElement
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
appendCharacters
protected void appendCharacters(nu.xom.Element parent, java.lang.String text) throws org.xml.sax.SAXException
- Specified by:
appendCharacters
in classCoalescingTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
appendChildrenToNewParent
protected void appendChildrenToNewParent(nu.xom.Element oldParent, nu.xom.Element newParent) throws org.xml.sax.SAXException
- Specified by:
appendChildrenToNewParent
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
appendComment
protected void appendComment(nu.xom.Element parent, java.lang.String comment) throws org.xml.sax.SAXException
- Specified by:
appendComment
in classCoalescingTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
appendCommentToDocument
protected void appendCommentToDocument(java.lang.String comment) throws org.xml.sax.SAXException
- Specified by:
appendCommentToDocument
in classCoalescingTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
createElement
protected nu.xom.Element createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Specified by:
createElement
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
createHtmlElementSetAsRoot
protected nu.xom.Element createHtmlElementSetAsRoot(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Specified by:
createHtmlElementSetAsRoot
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
detachFromParent
protected void detachFromParent(nu.xom.Element element) throws org.xml.sax.SAXException
- Specified by:
detachFromParent
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
appendElement
protected void appendElement(nu.xom.Element child, nu.xom.Element newParent) throws org.xml.sax.SAXException
- Specified by:
appendElement
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
hasChildren
protected boolean hasChildren(nu.xom.Element element) throws org.xml.sax.SAXException
- Specified by:
hasChildren
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
getDocument
nu.xom.Document getDocument()
Returns the document.- Returns:
- the document
-
getDocumentFragment
nu.xom.Nodes getDocumentFragment()
-
createElement
protected nu.xom.Element createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes, nu.xom.Element form) throws org.xml.sax.SAXException
- Overrides:
createElement
in classTreeBuilder<nu.xom.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:
start
in classTreeBuilder<nu.xom.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:
documentMode
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
- See Also:
TreeBuilder.documentMode(nu.validator.htmlparser.common.DocumentMode, java.lang.String, java.lang.String, boolean)
-
insertFosterParentedCharacters
protected void insertFosterParentedCharacters(java.lang.String text, nu.xom.Element table, nu.xom.Element stackParent) throws org.xml.sax.SAXException
- Specified by:
insertFosterParentedCharacters
in classCoalescingTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
insertFosterParentedChild
protected void insertFosterParentedChild(nu.xom.Element child, nu.xom.Element table, nu.xom.Element stackParent) throws org.xml.sax.SAXException
- Specified by:
insertFosterParentedChild
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
-
indexOfTable
private int indexOfTable(nu.xom.Element table, nu.xom.Element stackParent)
-
end
protected void end() throws org.xml.sax.SAXException
- Overrides:
end
in classTreeBuilder<nu.xom.Element>
- Throws:
org.xml.sax.SAXException
- See Also:
TreeBuilder.end()
-
-