Class TreeBuilder<T>
java.lang.Object
nu.validator.htmlparser.impl.TreeBuilder<T>
- All Implemented Interfaces:
TokenHandler, TreeBuilderState<T>
- Direct Known Subclasses:
CoalescingTreeBuilder, SAXStreamer, SAXTreeBuilder
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int(package private) static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate static final intprivate static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intprotected char[]protected intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int(package private) static final int(package private) static final int(package private) static final intprivate Stringprivate Stringprivate Tprivate int(package private) static final intprivate TUsed to work around Gecko limitations.(package private) static final intprivate DoctypeExpectationprivate DocumentModeHandler(package private) static final intprotected ErrorHandler(package private) static final intprivate LocatorImpl(package private) static final int(package private) static final int(package private) static final intprivate Tprivate boolean(package private) static final int(package private) static final intprivate static final intprivate booleanUsed only when moving back to IN_BODY.(package private) static final int(package private) static final intprivate T(package private) static final int(package private) static final intprivate static final Stringprivate booleanprivate static final String[]private final Map<String, LocatorImpl> (package private) static final int(package private) static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate intprivate XmlViolationPolicyprivate boolean(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate static final int(package private) static final int(package private) static final int(package private) static final intprivate int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate booleanprivate static final String[]private static final char[]Array version of U+FFFD.private boolean(package private) static final int(package private) static final int(package private) static final intprivate boolean(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate static final int(package private) static final int(package private) static final intprotected Tokenizer(package private) static final int(package private) static final intprivate boolean(package private) static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccumulateCharacters(char[] buf, int start, int length) private final voidaccumulateCharactersForced(char[] buf, int start, int length) private booleanaddAttributesToBody(HtmlAttributes attributes) Attempt to add attribute to the body element.protected abstract voidaddAttributesToElement(T element, HtmlAttributes attributes) private voidaddAttributesToHtml(HtmlAttributes attributes) private booleanadoptionAgencyEndTag(String name) private booleanannotationXmlEncodingPermitsHtml(HtmlAttributes attributes) private voidprotected abstract voidappendCharacters(T parent, char[] buf, int start, int length) protected abstract voidappendChildrenToNewParent(T oldParent, T newParent) protected abstract voidappendComment(T parent, char[] buf, int start, int length) protected abstract voidappendCommentToDocument(char[] buf, int start, int length) protected voidappendDoctypeToDocument(String name, String publicIdentifier, String systemIdentifier) protected abstract voidappendElement(T child, T newParent) private voidprivate voidappendHtmlElementToDocumentAndPush(HtmlAttributes attributes) protected abstract voidappendIsindexPrompt(T parent) private voidprivate voidappendToCurrentNodeAndPushBodyElement(HtmlAttributes attributes) private voidappendToCurrentNodeAndPushElement(ElementName elementName, HtmlAttributes attributes) private voidappendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes) private voidappendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes, T form) private voidappendToCurrentNodeAndPushElementMayFosterMathML(ElementName elementName, HtmlAttributes attributes) private voidappendToCurrentNodeAndPushElementMayFosterSVG(ElementName elementName, HtmlAttributes attributes) private voidappendToCurrentNodeAndPushFormattingElementMayFoster(ElementName elementName, HtmlAttributes attributes) private voidprivate voidappendToCurrentNodeAndPushHeadElement(HtmlAttributes attributes) private voidappendVoidElementToCurrent(String name, HtmlAttributes attributes, T form) private voidappendVoidElementToCurrentMayFoster(String name, HtmlAttributes attributes, T form) private voidappendVoidElementToCurrentMayFoster(ElementName elementName, HtmlAttributes attributes) private voidappendVoidElementToCurrentMayFosterMathML(ElementName elementName, HtmlAttributes attributes) private voidappendVoidElementToCurrentMayFosterSVG(ElementName elementName, HtmlAttributes attributes) private voidappendVoidFormToCurrent(HtmlAttributes attributes) booleanChecks if the CDATA sections are allowed.final voidcharacters(char[] buf, int start, int length) Receive character tokens.private booleanprivate voidcheckAttributes(HtmlAttributes attributes, String ns) private voidcheckMetaCharset(HtmlAttributes attributes) private StringcheckPopName(String name) private booleanprivate booleanprivate voidclearStackBackTo(int eltPos) private voidprivate voidcloseTheCell(int eltPos) final voidcomment(char[] buf, int start, int length) Receive a comment token.protected abstract TcreateElement(String ns, String name, HtmlAttributes attributes) protected TcreateElement(String ns, String name, HtmlAttributes attributes, T form) protected abstract TcreateHtmlElementSetAsRoot(HtmlAttributes attributes) protected final Tprotected abstract voiddetachFromParent(T element) final voidReceive a doctype token.protected voiddocumentMode(DocumentMode m, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) private voiddocumentModeInternal(DocumentMode m, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) protected voidelementPopped(String ns, String name, T node) protected voidelementPushed(String ns, String name, T node) protected voidend()final voidendTag(ElementName elementName) Receive an end tag token.final voidThe perform final cleanup.final voideof()The end-of-file token.(package private) final voidReports a Parse Error.private voidprivate voiderrBadStartTagInHead(String name) private voidprivate voidprivate voiderrEndTagDidNotMatchCurrentOpenElement(String name, String currOpenName) private voidprivate voidprivate voidprivate voidReports arriving at/near end of document with unclosed elements remaining.private voidprivate voidprivate voiderrFooSeenWhenFooOpen(String name) private voidprivate voidprivate voidprivate voidprivate voidprivate voiderrImage()private voidprivate voiderrListUnclosedStartTags(int eltPos) private void(package private) final voiderrNoCheck(String message) Reports a Parse Error without checking if an error handler is present.private voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voidprivate voiderrStartTagInTable(String name) private voiderrStartTagInTableBody(String name) private voidprivate voidprivate voidprivate voidprivate voiderrStrayEndTag(String name) Reports a stray end tag.private voiderrStrayStartTag(String name) Reports a stray start tag.private voidprivate voidprivate voidprivate voiderrUnclosedElements(int eltPos, String name) Reports a state when elements expected to be closed were not.private voiderrUnclosedElementsCell(int eltPos) Reports a state when elements expected to be closed ahead of an implied table cell close.private voiderrUnclosedElementsImplied(int eltPos, String name) Reports a state when elements expected to be closed ahead of an implied end tag but were not.static StringextractCharsetFromContent(String attributeValue) C++ memory note: The return value must be released.protected voidfatal()Reports an condition that would make the infoset incompatible with XML 1.0 as fatal.protected final void(package private) final voidprivate intfindInArray(StackNode<T> node, StackNode<T>[] arr) private intprivate intprivate intprivate intfindLastInButtonScope(String name) private intfindLastInListScope(String name) private intfindLastInScope(String name) private intprivate intfindLastInTableScope(String name) private intprivate intprivate intfindLastOrRoot(int group) private intfindLastOrRoot(String name) final voidFlushes the pending characters.private voidprivate voidReturns the deepTreeSurrogateParent.Returns the errorHandler.Returns the formPointer.Returns the headPointer.Returns the listOfActiveFormattingElements.intReturn the length of the list of active formatting elements.intgetMode()Returns the mode.intReturns the originalMode.getStack()Returns the stack.intReturn the length of the stack.protected abstract booleanhasChildren(T element) private voidprotected abstract voidinsertFosterParentedCharacters(char[] buf, int start, int length, T table, T stackParent) protected abstract voidinsertFosterParentedChild(T child, T table, T stackParent) private voidinsertIntoFosterParent(T child) private voidinsertIntoListOfActiveFormattingElements(StackNode<T> formattingClone, int bookmark) private voidinsertIntoStack(StackNode<T> node, int position) private voidprivate booleanisAlmostStandards(String publicIdentifier, String systemIdentifier) private booleanbooleanReturns the framesetOk.private booleanisHtml4Doctype(String publicIdentifier) private booleanprivate booleanprivate booleanbooleanReturns the needToDropLF.booleanisQuirks()Returns the quirks.private booleanbooleanReturns the scriptingEnabled.private booleanprivate booleanisSpecialParentInForeign(StackNode<T> stackNode) voidloadState(TreeBuilderState<T> snapshot, Interner interner) protected voidmarkMalformedIfScript(T elt) private voidmaybeForgetEarlierDuplicateFormattingElement(String name, HtmlAttributes attributes) Creates a comparable snapshot of the tree builder state.private voidpop()private voidpopOnEof()private voidprivate voidprivate voidprivate voidprivate voidremoveFromStack(int pos) private voidremoveFromStack(StackNode<T> node) private final voidreportUnclosedElementNameAndLocation(int pos) Reports the name and location of an unclosed element.protected final voidprivate voidvoidsetDoctypeExpectation(DoctypeExpectation doctypeExpectation) Sets the doctypeExpectation.voidsetDocumentModeHandler(DocumentModeHandler documentModeHandler) Sets the documentModeHandler.final voidsetErrorHandler(ErrorHandler errorHandler) Sets the errorHandler.final voidsetFragmentContext(String context) The argument MUST be an interned string ornull.final voidsetFragmentContext(String context, String ns, T node, boolean quirks) The argument MUST be an interned string ornull.voidsetIgnoringComments(boolean ignoreComments) voidsetNamePolicy(XmlViolationPolicy namePolicy) voidsetReportingDoctype(boolean reportingDoctype) Sets the reportingDoctype.voidsetScriptingEnabled(boolean scriptingEnabled) Sets the scriptingEnabled.private voidprivate voidsilentPush(StackNode<T> node) booleansnapshotMatches(TreeBuilderState<T> snapshot) protected voidstart(boolean fragmentMode) final voidstartTag(ElementName elementName, HtmlAttributes attributes, boolean selfClosing) Receive a start tag token.final voidstartTokenization(Tokenizer self) This method is called at the start of tokenization before any other methods on this interface are called.booleanIf this handler implementation cares about comments, returntrue.(package private) final voidReports a warning(package private) final voidReports a warning with an explicit locatorvoidReports a U+0000 that's being turned into a U+FFFD.
-
Field Details
-
REPLACEMENT_CHARACTER
private static final char[] REPLACEMENT_CHARACTERArray version of U+FFFD. -
OTHER
static final int OTHER- See Also:
-
A
static final int A- See Also:
-
BASE
static final int BASE- See Also:
-
BODY
static final int BODY- See Also:
-
BR
static final int BR- See Also:
-
BUTTON
static final int BUTTON- See Also:
-
CAPTION
static final int CAPTION- See Also:
-
COL
static final int COL- See Also:
-
COLGROUP
static final int COLGROUP- See Also:
-
FORM
static final int FORM- See Also:
-
FRAME
static final int FRAME- See Also:
-
FRAMESET
static final int FRAMESET- See Also:
-
IMAGE
static final int IMAGE- See Also:
-
INPUT
static final int INPUT- See Also:
-
ISINDEX
static final int ISINDEX- See Also:
-
LI
static final int LI- See Also:
-
LINK_OR_BASEFONT_OR_BGSOUND
static final int LINK_OR_BASEFONT_OR_BGSOUND- See Also:
-
MATH
static final int MATH- See Also:
-
META
static final int META- See Also:
-
SVG
static final int SVG- See Also:
-
HEAD
static final int HEAD- See Also:
-
HR
static final int HR- See Also:
-
HTML
static final int HTML- See Also:
-
NOBR
static final int NOBR- See Also:
-
NOFRAMES
static final int NOFRAMES- See Also:
-
NOSCRIPT
static final int NOSCRIPT- See Also:
-
OPTGROUP
static final int OPTGROUP- See Also:
-
OPTION
static final int OPTION- See Also:
-
P
static final int P- See Also:
-
PLAINTEXT
static final int PLAINTEXT- See Also:
-
SCRIPT
static final int SCRIPT- See Also:
-
SELECT
static final int SELECT- See Also:
-
STYLE
static final int STYLE- See Also:
-
TABLE
static final int TABLE- See Also:
-
TEXTAREA
static final int TEXTAREA- See Also:
-
TITLE
static final int TITLE- See Also:
-
TR
static final int TR- See Also:
-
XMP
static final int XMP- See Also:
-
TBODY_OR_THEAD_OR_TFOOT
static final int TBODY_OR_THEAD_OR_TFOOT- See Also:
-
TD_OR_TH
static final int TD_OR_TH- See Also:
-
DD_OR_DT
static final int DD_OR_DT- See Also:
-
H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6
static final int H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6- See Also:
-
MARQUEE_OR_APPLET
static final int MARQUEE_OR_APPLET- See Also:
-
PRE_OR_LISTING
static final int PRE_OR_LISTING- See Also:
-
B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U
static final int B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U- See Also:
-
UL_OR_OL_OR_DL
static final int UL_OR_OL_OR_DL- See Also:
-
IFRAME
static final int IFRAME- See Also:
-
EMBED_OR_IMG
static final int EMBED_OR_IMG- See Also:
-
AREA_OR_WBR
static final int AREA_OR_WBR- See Also:
-
DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU
static final int DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU- See Also:
-
ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_NAV_OR_SECTION_OR_SUMMARY
static final int ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_NAV_OR_SECTION_OR_SUMMARY- See Also:
-
RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR
static final int RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR- See Also:
-
RT_OR_RP
static final int RT_OR_RP- See Also:
-
COMMAND
static final int COMMAND- See Also:
-
PARAM_OR_SOURCE_OR_TRACK
static final int PARAM_OR_SOURCE_OR_TRACK- See Also:
-
MGLYPH_OR_MALIGNMARK
static final int MGLYPH_OR_MALIGNMARK- See Also:
-
MI_MO_MN_MS_MTEXT
static final int MI_MO_MN_MS_MTEXT- See Also:
-
ANNOTATION_XML
static final int ANNOTATION_XML- See Also:
-
FOREIGNOBJECT_OR_DESC
static final int FOREIGNOBJECT_OR_DESC- See Also:
-
NOEMBED
static final int NOEMBED- See Also:
-
FIELDSET
static final int FIELDSET- See Also:
-
OUTPUT_OR_LABEL
static final int OUTPUT_OR_LABEL- See Also:
-
OBJECT
static final int OBJECT- See Also:
-
FONT
static final int FONT- See Also:
-
KEYGEN
static final int KEYGEN- See Also:
-
MENUITEM
static final int MENUITEM- See Also:
-
INITIAL
private static final int INITIAL- See Also:
-
BEFORE_HTML
private static final int BEFORE_HTML- See Also:
-
BEFORE_HEAD
private static final int BEFORE_HEAD- See Also:
-
IN_HEAD
private static final int IN_HEAD- See Also:
-
IN_HEAD_NOSCRIPT
private static final int IN_HEAD_NOSCRIPT- See Also:
-
AFTER_HEAD
private static final int AFTER_HEAD- See Also:
-
IN_BODY
private static final int IN_BODY- See Also:
-
IN_TABLE
private static final int IN_TABLE- See Also:
-
IN_CAPTION
private static final int IN_CAPTION- See Also:
-
IN_COLUMN_GROUP
private static final int IN_COLUMN_GROUP- See Also:
-
IN_TABLE_BODY
private static final int IN_TABLE_BODY- See Also:
-
IN_ROW
private static final int IN_ROW- See Also:
-
IN_CELL
private static final int IN_CELL- See Also:
-
IN_SELECT
private static final int IN_SELECT- See Also:
-
IN_SELECT_IN_TABLE
private static final int IN_SELECT_IN_TABLE- See Also:
-
AFTER_BODY
private static final int AFTER_BODY- See Also:
-
IN_FRAMESET
private static final int IN_FRAMESET- See Also:
-
AFTER_FRAMESET
private static final int AFTER_FRAMESET- See Also:
-
AFTER_AFTER_BODY
private static final int AFTER_AFTER_BODY- See Also:
-
AFTER_AFTER_FRAMESET
private static final int AFTER_AFTER_FRAMESET- See Also:
-
TEXT
private static final int TEXT- See Also:
-
FRAMESET_OK
private static final int FRAMESET_OK- See Also:
-
CHARSET_INITIAL
private static final int CHARSET_INITIAL- See Also:
-
CHARSET_C
private static final int CHARSET_C- See Also:
-
CHARSET_H
private static final int CHARSET_H- See Also:
-
CHARSET_A
private static final int CHARSET_A- See Also:
-
CHARSET_R
private static final int CHARSET_R- See Also:
-
CHARSET_S
private static final int CHARSET_S- See Also:
-
CHARSET_E
private static final int CHARSET_E- See Also:
-
CHARSET_T
private static final int CHARSET_T- See Also:
-
CHARSET_EQUALS
private static final int CHARSET_EQUALS- See Also:
-
CHARSET_SINGLE_QUOTED
private static final int CHARSET_SINGLE_QUOTED- See Also:
-
CHARSET_DOUBLE_QUOTED
private static final int CHARSET_DOUBLE_QUOTED- See Also:
-
CHARSET_UNQUOTED
private static final int CHARSET_UNQUOTED- See Also:
-
HTML4_PUBLIC_IDS
-
QUIRKY_PUBLIC_IDS
-
NOT_FOUND_ON_STACK
private static final int NOT_FOUND_ON_STACK- See Also:
-
HTML_LOCAL
- See Also:
-
mode
private int mode -
originalMode
private int originalMode -
framesetOk
private boolean framesetOkUsed only when moving back to IN_BODY. -
tokenizer
-
errorHandler
-
documentModeHandler
-
doctypeExpectation
-
firstCommentLocation
-
scriptingEnabled
private boolean scriptingEnabled -
needToDropLF
private boolean needToDropLF -
wantingComments
private boolean wantingComments -
fragment
private boolean fragment -
contextName
-
contextNamespace
-
contextNode
-
stack
-
currentPtr
private int currentPtr -
listOfActiveFormattingElements
-
listPtr
private int listPtr -
formPointer
-
headPointer
-
deepTreeSurrogateParent
Used to work around Gecko limitations. Not used in Java. -
charBuffer
protected char[] charBuffer -
charBufferLen
protected int charBufferLen -
quirks
private boolean quirks -
reportingDoctype
private boolean reportingDoctype -
namePolicy
-
idLocations
-
html4
private boolean html4
-
-
Constructor Details
-
TreeBuilder
protected TreeBuilder()
-
-
Method Details
-
fatal
Reports an condition that would make the infoset incompatible with XML 1.0 as fatal.- Throws:
SAXExceptionSAXParseException
-
fatal
- Throws:
SAXException
-
fatal
- Throws:
SAXException
-
err
Reports a Parse Error.- Parameters:
message- the message- Throws:
SAXException
-
errNoCheck
Reports a Parse Error without checking if an error handler is present.- Parameters:
message- the message- Throws:
SAXException
-
errListUnclosedStartTags
- Throws:
SAXException
-
reportUnclosedElementNameAndLocation
Reports the name and location of an unclosed element.- Throws:
SAXException
-
warn
Reports a warning- Parameters:
message- the message- Throws:
SAXException
-
warn
Reports a warning with an explicit locator- Parameters:
message- the message- Throws:
SAXException
-
startTokenization
Description copied from interface:TokenHandlerThis method is called at the start of tokenization before any other methods on this interface are called. Implementations should hold the reference to theTokenizerin order to set the content model flag and in order to be able to query forLocatordata.- Specified by:
startTokenizationin interfaceTokenHandler- Parameters:
self- theTokenizer.- Throws:
SAXException- if something went wrong
-
doctype
public final void doctype(String name, String publicIdentifier, String systemIdentifier, boolean forceQuirks) throws SAXException Description copied from interface:TokenHandlerReceive a doctype token.- Specified by:
doctypein interfaceTokenHandler- Parameters:
name- the namepublicIdentifier- the public idsystemIdentifier- the system idforceQuirks- whether the token is correct- Throws:
SAXException- if something went wrong
-
isHtml4Doctype
-
comment
Description copied from interface:TokenHandlerReceive a comment token. The data is junk if thewantsComments()returnedfalse.- Specified by:
commentin interfaceTokenHandler- Parameters:
buf- a buffer holding the datastart- the offset into the bufferlength- the number of code units to read- Throws:
SAXException- if something went wrong
-
characters
Description copied from interface:TokenHandlerReceive character tokens. This method has the same semantics as the SAX method of the same name.- Specified by:
charactersin interfaceTokenHandler- Parameters:
buf- a buffer holding the datastart- offset into the bufferlength- the number of code units to read- Throws:
SAXException- if something went wrong- See Also:
-
zeroOriginatingReplacementCharacter
Description copied from interface:TokenHandlerReports a U+0000 that's being turned into a U+FFFD.- Specified by:
zeroOriginatingReplacementCharacterin interfaceTokenHandler- Throws:
SAXException- if something went wrong- See Also:
-
eof
Description copied from interface:TokenHandlerThe end-of-file token.- Specified by:
eofin interfaceTokenHandler- Throws:
SAXException- if something went wrong
-
endTokenization
Description copied from interface:TokenHandlerThe perform final cleanup.- Specified by:
endTokenizationin interfaceTokenHandler- Throws:
SAXException- if something went wrong- See Also:
-
startTag
public final void startTag(ElementName elementName, HtmlAttributes attributes, boolean selfClosing) throws SAXException Description copied from interface:TokenHandlerReceive a start tag token.- Specified by:
startTagin interfaceTokenHandler- Parameters:
elementName- the tag nameattributes- the attributesselfClosing- TODO- Throws:
SAXException- if something went wrong
-
isSpecialParentInForeign
-
extractCharsetFromContent
-
checkMetaCharset
- Throws:
SAXException
-
endTag
Description copied from interface:TokenHandlerReceive an end tag token.- Specified by:
endTagin interfaceTokenHandler- Parameters:
elementName- the tag name- Throws:
SAXException- if something went wrong
-
findLastInTableScopeOrRootTbodyTheadTfoot
private int findLastInTableScopeOrRootTbodyTheadTfoot() -
findLast
-
findLastInTableScope
-
findLastInButtonScope
-
findLastInScope
-
findLastInListScope
-
findLastInScopeHn
private int findLastInScopeHn() -
generateImpliedEndTagsExceptFor
- Throws:
SAXException
-
generateImpliedEndTags
- Throws:
SAXException
-
isSecondOnStackBody
private boolean isSecondOnStackBody() -
documentModeInternal
private void documentModeInternal(DocumentMode m, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws SAXException - Throws:
SAXException
-
isAlmostStandards
-
isQuirky
-
closeTheCell
- Throws:
SAXException
-
findLastInTableScopeTdTh
private int findLastInTableScopeTdTh() -
clearStackBackTo
- Throws:
SAXException
-
resetTheInsertionMode
private void resetTheInsertionMode() -
implicitlyCloseP
- Throws:
SAXException
-
clearLastStackSlot
private boolean clearLastStackSlot() -
clearLastListSlot
private boolean clearLastListSlot() -
push
- Throws:
SAXException
-
silentPush
- Throws:
SAXException
-
append
-
insertMarker
private void insertMarker() -
clearTheListOfActiveFormattingElementsUpToTheLastMarker
private void clearTheListOfActiveFormattingElementsUpToTheLastMarker() -
isCurrent
-
removeFromStack
- Throws:
SAXException
-
removeFromStack
- Throws:
SAXException
-
removeFromListOfActiveFormattingElements
private void removeFromListOfActiveFormattingElements(int pos) -
adoptionAgencyEndTag
- Throws:
SAXException
-
insertIntoStack
- Throws:
SAXException
-
insertIntoListOfActiveFormattingElements
-
findInListOfActiveFormattingElements
-
findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker
-
maybeForgetEarlierDuplicateFormattingElement
private void maybeForgetEarlierDuplicateFormattingElement(String name, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
findLastOrRoot
-
findLastOrRoot
private int findLastOrRoot(int group) -
addAttributesToBody
Attempt to add attribute to the body element.- Parameters:
attributes- the attributes- Returns:
trueiff the attributes were added- Throws:
SAXException
-
addAttributesToHtml
- Throws:
SAXException
-
pushHeadPointerOntoStack
- Throws:
SAXException
-
reconstructTheActiveFormattingElements
- Throws:
SAXException
-
insertIntoFosterParent
- Throws:
SAXException
-
isInStack
-
pop
- Throws:
SAXException
-
silentPop
- Throws:
SAXException
-
popOnEof
- Throws:
SAXException
-
checkAttributes
- Throws:
SAXException
-
checkPopName
- Throws:
SAXException
-
appendHtmlElementToDocumentAndPush
- Throws:
SAXException
-
appendHtmlElementToDocumentAndPush
- Throws:
SAXException
-
appendToCurrentNodeAndPushHeadElement
- Throws:
SAXException
-
appendToCurrentNodeAndPushBodyElement
- Throws:
SAXException
-
appendToCurrentNodeAndPushBodyElement
- Throws:
SAXException
-
appendToCurrentNodeAndPushFormElementMayFoster
private void appendToCurrentNodeAndPushFormElementMayFoster(HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendToCurrentNodeAndPushFormattingElementMayFoster
private void appendToCurrentNodeAndPushFormattingElementMayFoster(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendToCurrentNodeAndPushElement
private void appendToCurrentNodeAndPushElement(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendToCurrentNodeAndPushElementMayFoster
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendToCurrentNodeAndPushElementMayFosterMathML
private void appendToCurrentNodeAndPushElementMayFosterMathML(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
annotationXmlEncodingPermitsHtml
-
appendToCurrentNodeAndPushElementMayFosterSVG
private void appendToCurrentNodeAndPushElementMayFosterSVG(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendToCurrentNodeAndPushElementMayFoster
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes, T form) throws SAXException - Throws:
SAXException
-
appendVoidElementToCurrentMayFoster
private void appendVoidElementToCurrentMayFoster(String name, HtmlAttributes attributes, T form) throws SAXException - Throws:
SAXException
-
appendVoidElementToCurrentMayFoster
private void appendVoidElementToCurrentMayFoster(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendVoidElementToCurrentMayFosterSVG
private void appendVoidElementToCurrentMayFosterSVG(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendVoidElementToCurrentMayFosterMathML
private void appendVoidElementToCurrentMayFosterMathML(ElementName elementName, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
appendVoidElementToCurrent
private void appendVoidElementToCurrent(String name, HtmlAttributes attributes, T form) throws SAXException - Throws:
SAXException
-
appendVoidFormToCurrent
- Throws:
SAXException
-
accumulateCharactersForced
private final void accumulateCharactersForced(char[] buf, int start, int length) throws SAXException - Throws:
SAXException
-
accumulateCharacters
- Throws:
SAXException
-
requestSuspension
protected final void requestSuspension() -
createElement
protected abstract T createElement(String ns, String name, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
createElement
protected T createElement(String ns, String name, HtmlAttributes attributes, T form) throws SAXException - Throws:
SAXException
-
createHtmlElementSetAsRoot
- Throws:
SAXException
-
detachFromParent
- Throws:
SAXException
-
hasChildren
- Throws:
SAXException
-
appendElement
- Throws:
SAXException
-
appendChildrenToNewParent
- Throws:
SAXException
-
insertFosterParentedChild
protected abstract void insertFosterParentedChild(T child, T table, T stackParent) throws SAXException - Throws:
SAXException
-
insertFosterParentedCharacters
protected abstract void insertFosterParentedCharacters(char[] buf, int start, int length, T table, T stackParent) throws SAXException - Throws:
SAXException
-
appendCharacters
protected abstract void appendCharacters(T parent, char[] buf, int start, int length) throws SAXException - Throws:
SAXException
-
appendIsindexPrompt
- Throws:
SAXException
-
appendComment
protected abstract void appendComment(T parent, char[] buf, int start, int length) throws SAXException - Throws:
SAXException
-
appendCommentToDocument
protected abstract void appendCommentToDocument(char[] buf, int start, int length) throws SAXException - Throws:
SAXException
-
addAttributesToElement
protected abstract void addAttributesToElement(T element, HtmlAttributes attributes) throws SAXException - Throws:
SAXException
-
markMalformedIfScript
- Throws:
SAXException
-
start
- Throws:
SAXException
-
end
- Throws:
SAXException
-
appendDoctypeToDocument
protected void appendDoctypeToDocument(String name, String publicIdentifier, String systemIdentifier) throws SAXException - Throws:
SAXException
-
elementPushed
- Throws:
SAXException
-
elementPopped
- Throws:
SAXException
-
documentMode
protected void documentMode(DocumentMode m, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws SAXException - Throws:
SAXException
-
wantsComments
public boolean wantsComments()Description copied from interface:TokenHandlerIf this handler implementation cares about comments, returntrue. If not, returnfalse.- Specified by:
wantsCommentsin interfaceTokenHandler- Returns:
- whether this handler wants comments
- See Also:
-
setIgnoringComments
public void setIgnoringComments(boolean ignoreComments) -
setErrorHandler
Sets the errorHandler.- Parameters:
errorHandler- the errorHandler to set
-
getErrorHandler
-
setFragmentContext
The argument MUST be an interned string ornull.- Parameters:
context-
-
cdataSectionAllowed
Description copied from interface:TokenHandlerChecks if the CDATA sections are allowed.- Specified by:
cdataSectionAllowedin interfaceTokenHandler- Returns:
trueif CDATA sections are allowed- Throws:
SAXException- if something went wrong- See Also:
-
isInForeign
private boolean isInForeign() -
isInForeignButNotHtmlOrMathTextIntegrationPoint
private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint() -
setFragmentContext
-
currentNode
-
isScriptingEnabled
public boolean isScriptingEnabled()Returns the scriptingEnabled.- Returns:
- the scriptingEnabled
-
setScriptingEnabled
public void setScriptingEnabled(boolean scriptingEnabled) Sets the scriptingEnabled.- Parameters:
scriptingEnabled- the scriptingEnabled to set
-
setDoctypeExpectation
Sets the doctypeExpectation.- Parameters:
doctypeExpectation- the doctypeExpectation to set
-
setNamePolicy
-
setDocumentModeHandler
Sets the documentModeHandler.- Parameters:
documentModeHandler- the documentModeHandler to set
-
setReportingDoctype
public void setReportingDoctype(boolean reportingDoctype) Sets the reportingDoctype.- Parameters:
reportingDoctype- the reportingDoctype to set
-
flushCharacters
Flushes the pending characters. Public for document.write use cases only.- Throws:
SAXException
-
charBufferContainsNonWhitespace
private boolean charBufferContainsNonWhitespace() -
newSnapshot
Creates a comparable snapshot of the tree builder state. Snapshot creation is only supported immediately after a script end tag has been processed. In C++ the caller is responsible for callingdeleteon the returned object.- Returns:
- a snapshot.
- Throws:
SAXException
-
snapshotMatches
-
loadState
- Throws:
SAXException
-
findInArray
-
getFormPointer
Description copied from interface:TreeBuilderStateReturns the formPointer.- Specified by:
getFormPointerin interfaceTreeBuilderState<T>- Returns:
- the formPointer
- See Also:
-
getHeadPointer
Returns the headPointer.- Specified by:
getHeadPointerin interfaceTreeBuilderState<T>- Returns:
- the headPointer
-
getDeepTreeSurrogateParent
Returns the deepTreeSurrogateParent.- Specified by:
getDeepTreeSurrogateParentin interfaceTreeBuilderState<T>- Returns:
- the deepTreeSurrogateParent
-
getListOfActiveFormattingElements
Description copied from interface:TreeBuilderStateReturns the listOfActiveFormattingElements.- Specified by:
getListOfActiveFormattingElementsin interfaceTreeBuilderState<T>- Returns:
- the listOfActiveFormattingElements
- See Also:
-
getStack
Description copied from interface:TreeBuilderStateReturns the stack.- Specified by:
getStackin interfaceTreeBuilderState<T>- Returns:
- the stack
- See Also:
-
getMode
public int getMode()Returns the mode.- Specified by:
getModein interfaceTreeBuilderState<T>- Returns:
- the mode
-
getOriginalMode
public int getOriginalMode()Returns the originalMode.- Specified by:
getOriginalModein interfaceTreeBuilderState<T>- Returns:
- the originalMode
-
isFramesetOk
public boolean isFramesetOk()Returns the framesetOk.- Specified by:
isFramesetOkin interfaceTreeBuilderState<T>- Returns:
- the framesetOk
-
isNeedToDropLF
public boolean isNeedToDropLF()Returns the needToDropLF.- Specified by:
isNeedToDropLFin interfaceTreeBuilderState<T>- Returns:
- the needToDropLF
-
isQuirks
public boolean isQuirks()Returns the quirks.- Specified by:
isQuirksin interfaceTreeBuilderState<T>- Returns:
- the quirks
-
getListOfActiveFormattingElementsLength
public int getListOfActiveFormattingElementsLength()Description copied from interface:TreeBuilderStateReturn the length of the list of active formatting elements.- Specified by:
getListOfActiveFormattingElementsLengthin interfaceTreeBuilderState<T>- Returns:
- the length of the list of active formatting elements.
- See Also:
-
getStackLength
public int getStackLength()Description copied from interface:TreeBuilderStateReturn the length of the stack.- Specified by:
getStackLengthin interfaceTreeBuilderState<T>- Returns:
- the length of the stack.
- See Also:
-
errStrayStartTag
Reports a stray start tag.- Parameters:
name- the name of the stray tag- Throws:
SAXException
-
errStrayEndTag
Reports a stray end tag.- Parameters:
name- the name of the stray tag- Throws:
SAXException
-
errUnclosedElements
Reports a state when elements expected to be closed were not.- Parameters:
eltPos- the position of the start tag on the stack of the element being closed.name- the name of the end tag- Throws:
SAXException
-
errUnclosedElementsImplied
Reports a state when elements expected to be closed ahead of an implied end tag but were not.- Parameters:
eltPos- the position of the start tag on the stack of the element being closed.name- the name of the end tag- Throws:
SAXException
-
errUnclosedElementsCell
Reports a state when elements expected to be closed ahead of an implied table cell close.- Parameters:
eltPos- the position of the start tag on the stack of the element being closed.- Throws:
SAXException
-
errStrayDoctype
- Throws:
SAXException
-
errAlmostStandardsDoctype
- Throws:
SAXException
-
errQuirkyDoctype
- Throws:
SAXException
-
errNonSpaceInTrailer
- Throws:
SAXException
-
errNonSpaceAfterFrameset
- Throws:
SAXException
-
errNonSpaceInFrameset
- Throws:
SAXException
-
errNonSpaceAfterBody
- Throws:
SAXException
-
errNonSpaceInColgroupInFragment
- Throws:
SAXException
-
errNonSpaceInNoscriptInHead
- Throws:
SAXException
-
errFooBetweenHeadAndBody
- Throws:
SAXException
-
errStartTagWithoutDoctype
- Throws:
SAXException
-
errNoSelectInTableScope
- Throws:
SAXException
-
errStartSelectWhereEndSelectExpected
- Throws:
SAXException
-
errStartTagWithSelectOpen
- Throws:
SAXException
-
errBadStartTagInHead
- Throws:
SAXException
-
errImage
- Throws:
SAXException
-
errIsindex
- Throws:
SAXException
-
errFooSeenWhenFooOpen
- Throws:
SAXException
-
errHeadingWhenHeadingOpen
- Throws:
SAXException
-
errFramesetStart
- Throws:
SAXException
-
errNoCellToClose
- Throws:
SAXException
-
errStartTagInTable
- Throws:
SAXException
-
errFormWhenFormOpen
- Throws:
SAXException
-
errTableSeenWhileTableOpen
- Throws:
SAXException
-
errStartTagInTableBody
- Throws:
SAXException
-
errEndTagSeenWithoutDoctype
- Throws:
SAXException
-
errEndTagAfterBody
- Throws:
SAXException
-
errEndTagSeenWithSelectOpen
- Throws:
SAXException
-
errGarbageInColgroup
- Throws:
SAXException
-
errEndTagBr
- Throws:
SAXException
-
errNoElementToCloseButEndTagSeen
- Throws:
SAXException
-
errHtmlStartTagInForeignContext
- Throws:
SAXException
-
errTableClosedWhileCaptionOpen
- Throws:
SAXException
-
errNoTableRowToClose
- Throws:
SAXException
-
errNonSpaceInTable
- Throws:
SAXException
-
errUnclosedChildrenInRuby
- Throws:
SAXException
-
errStartTagSeenWithoutRuby
- Throws:
SAXException
-
errSelfClosing
- Throws:
SAXException
-
errNoCheckUnclosedElementsOnStack
- Throws:
SAXException
-
errEndTagDidNotMatchCurrentOpenElement
private void errEndTagDidNotMatchCurrentOpenElement(String name, String currOpenName) throws SAXException - Throws:
SAXException
-
errEndTagViolatesNestingRules
- Throws:
SAXException
-
errEofWithUnclosedElements
- Throws:
SAXException
-
errEndWithUnclosedElements
Reports arriving at/near end of document with unclosed elements remaining.- Parameters:
message- the message- Throws:
SAXException
-