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.ElementcachedTableprivate intcachedTableIndexprivate nu.xom.Documentdocumentprivate SimpleNodeFactorynodeFactory-
Fields inherited from class nu.validator.htmlparser.impl.TreeBuilder
charBuffer, charBufferLen, errorHandler, tokenizer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedXOMTreeBuilder(SimpleNodeFactory nodeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAttributesToElement(nu.xom.Element element, HtmlAttributes attributes)protected voidappendCharacters(nu.xom.Element parent, java.lang.String text)protected voidappendChildrenToNewParent(nu.xom.Element oldParent, nu.xom.Element newParent)protected voidappendComment(nu.xom.Element parent, java.lang.String comment)protected voidappendCommentToDocument(java.lang.String comment)protected voidappendElement(nu.xom.Element child, nu.xom.Element newParent)protected nu.xom.ElementcreateElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes)protected nu.xom.ElementcreateElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes, nu.xom.Element form)protected nu.xom.ElementcreateHtmlElementSetAsRoot(HtmlAttributes attributes)protected voiddetachFromParent(nu.xom.Element element)protected voiddocumentMode(DocumentMode mode, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)protected voidend()(package private) nu.xom.DocumentgetDocument()Returns the document.(package private) nu.xom.NodesgetDocumentFragment()protected booleanhasChildren(nu.xom.Element element)private intindexOfTable(nu.xom.Element table, nu.xom.Element stackParent)protected voidinsertFosterParentedCharacters(java.lang.String text, nu.xom.Element table, nu.xom.Element stackParent)protected voidinsertFosterParentedChild(nu.xom.Element child, nu.xom.Element table, nu.xom.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, 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:
addAttributesToElementin 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:
appendCharactersin 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:
appendChildrenToNewParentin 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:
appendCommentin classCoalescingTreeBuilder<nu.xom.Element>- Throws:
org.xml.sax.SAXException
-
appendCommentToDocument
protected void appendCommentToDocument(java.lang.String comment) throws org.xml.sax.SAXException- Specified by:
appendCommentToDocumentin 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:
createElementin classTreeBuilder<nu.xom.Element>- Throws:
org.xml.sax.SAXException
-
createHtmlElementSetAsRoot
protected nu.xom.Element createHtmlElementSetAsRoot(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Specified by:
createHtmlElementSetAsRootin classTreeBuilder<nu.xom.Element>- Throws:
org.xml.sax.SAXException
-
detachFromParent
protected void detachFromParent(nu.xom.Element element) throws org.xml.sax.SAXException- Specified by:
detachFromParentin 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:
appendElementin classTreeBuilder<nu.xom.Element>- Throws:
org.xml.sax.SAXException
-
hasChildren
protected boolean hasChildren(nu.xom.Element element) throws org.xml.sax.SAXException- Specified by:
hasChildrenin 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:
createElementin 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:
startin 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:
documentModein 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:
insertFosterParentedCharactersin 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:
insertFosterParentedChildin 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:
endin classTreeBuilder<nu.xom.Element>- Throws:
org.xml.sax.SAXException- See Also:
TreeBuilder.end()
-
-