Package nu.validator.htmlparser.impl
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 int
private static final int
private static final int
private static final int
private static final int
private static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
private static final int
private static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
protected char[]
protected int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
(package private) static final int
(package private) static final int
(package private) static final int
private String
private String
private T
private int
(package private) static final int
private T
Used to work around Gecko limitations.(package private) static final int
private DoctypeExpectation
private DocumentModeHandler
(package private) static final int
protected ErrorHandler
(package private) static final int
private LocatorImpl
(package private) static final int
(package private) static final int
(package private) static final int
private T
private boolean
(package private) static final int
(package private) static final int
private static final int
private boolean
Used only when moving back to IN_BODY.(package private) static final int
(package private) static final int
private T
(package private) static final int
(package private) static final int
private static final String
private boolean
private static final String[]
private final Map
<String, LocatorImpl> (package private) static final int
(package private) static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
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 int
private 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 int
private int
private XmlViolationPolicy
private boolean
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
private static final int
(package private) static final int
(package private) static final int
(package private) static final int
private 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 int
private boolean
private 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 int
private 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 int
private static final int
(package private) static final int
(package private) static final int
protected Tokenizer
(package private) static final int
(package private) static final int
private boolean
(package private) static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
accumulateCharacters
(char[] buf, int start, int length) private final void
accumulateCharactersForced
(char[] buf, int start, int length) private boolean
addAttributesToBody
(HtmlAttributes attributes) Attempt to add attribute to the body element.protected abstract void
addAttributesToElement
(T element, HtmlAttributes attributes) private void
addAttributesToHtml
(HtmlAttributes attributes) private boolean
adoptionAgencyEndTag
(String name) private boolean
annotationXmlEncodingPermitsHtml
(HtmlAttributes attributes) private void
protected abstract void
appendCharacters
(T parent, char[] buf, int start, int length) protected abstract void
appendChildrenToNewParent
(T oldParent, T newParent) protected abstract void
appendComment
(T parent, char[] buf, int start, int length) protected abstract void
appendCommentToDocument
(char[] buf, int start, int length) protected void
appendDoctypeToDocument
(String name, String publicIdentifier, String systemIdentifier) protected abstract void
appendElement
(T child, T newParent) private void
private void
appendHtmlElementToDocumentAndPush
(HtmlAttributes attributes) protected abstract void
appendIsindexPrompt
(T parent) private void
private void
appendToCurrentNodeAndPushBodyElement
(HtmlAttributes attributes) private void
appendToCurrentNodeAndPushElement
(ElementName elementName, HtmlAttributes attributes) private void
appendToCurrentNodeAndPushElementMayFoster
(ElementName elementName, HtmlAttributes attributes) private void
appendToCurrentNodeAndPushElementMayFoster
(ElementName elementName, HtmlAttributes attributes, T form) private void
appendToCurrentNodeAndPushElementMayFosterMathML
(ElementName elementName, HtmlAttributes attributes) private void
appendToCurrentNodeAndPushElementMayFosterSVG
(ElementName elementName, HtmlAttributes attributes) private void
appendToCurrentNodeAndPushFormattingElementMayFoster
(ElementName elementName, HtmlAttributes attributes) private void
private void
appendToCurrentNodeAndPushHeadElement
(HtmlAttributes attributes) private void
appendVoidElementToCurrent
(String name, HtmlAttributes attributes, T form) private void
appendVoidElementToCurrentMayFoster
(String name, HtmlAttributes attributes, T form) private void
appendVoidElementToCurrentMayFoster
(ElementName elementName, HtmlAttributes attributes) private void
appendVoidElementToCurrentMayFosterMathML
(ElementName elementName, HtmlAttributes attributes) private void
appendVoidElementToCurrentMayFosterSVG
(ElementName elementName, HtmlAttributes attributes) private void
appendVoidFormToCurrent
(HtmlAttributes attributes) boolean
Checks if the CDATA sections are allowed.final void
characters
(char[] buf, int start, int length) Receive character tokens.private boolean
private void
checkAttributes
(HtmlAttributes attributes, String ns) private void
checkMetaCharset
(HtmlAttributes attributes) private String
checkPopName
(String name) private boolean
private boolean
private void
clearStackBackTo
(int eltPos) private void
private void
closeTheCell
(int eltPos) final void
comment
(char[] buf, int start, int length) Receive a comment token.protected abstract T
createElement
(String ns, String name, HtmlAttributes attributes) protected T
createElement
(String ns, String name, HtmlAttributes attributes, T form) protected abstract T
createHtmlElementSetAsRoot
(HtmlAttributes attributes) protected final T
protected abstract void
detachFromParent
(T element) final void
Receive a doctype token.protected void
documentMode
(DocumentMode m, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) private void
documentModeInternal
(DocumentMode m, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) protected void
elementPopped
(String ns, String name, T node) protected void
elementPushed
(String ns, String name, T node) protected void
end()
final void
endTag
(ElementName elementName) Receive an end tag token.final void
The perform final cleanup.final void
eof()
The end-of-file token.(package private) final void
Reports a Parse Error.private void
private void
errBadStartTagInHead
(String name) private void
private void
private void
errEndTagDidNotMatchCurrentOpenElement
(String name, String currOpenName) private void
private void
private void
private void
Reports arriving at/near end of document with unclosed elements remaining.private void
private void
private void
errFooSeenWhenFooOpen
(String name) private void
private void
private void
private void
private void
private void
errImage()
private void
private void
errListUnclosedStartTags
(int eltPos) private void
(package private) final void
errNoCheck
(String message) Reports a Parse Error without checking if an error handler is present.private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
errStartTagInTable
(String name) private void
errStartTagInTableBody
(String name) private void
private void
private void
private void
private void
errStrayEndTag
(String name) Reports a stray end tag.private void
errStrayStartTag
(String name) Reports a stray start tag.private void
private void
private void
private void
errUnclosedElements
(int eltPos, String name) Reports a state when elements expected to be closed were not.private void
errUnclosedElementsCell
(int eltPos) Reports a state when elements expected to be closed ahead of an implied table cell close.private void
errUnclosedElementsImplied
(int eltPos, String name) Reports a state when elements expected to be closed ahead of an implied end tag but were not.static String
extractCharsetFromContent
(String attributeValue) C++ memory note: The return value must be released.protected void
fatal()
Reports an condition that would make the infoset incompatible with XML 1.0 as fatal.protected final void
(package private) final void
private int
findInArray
(StackNode<T> node, StackNode<T>[] arr) private int
private int
private int
private int
findLastInButtonScope
(String name) private int
findLastInListScope
(String name) private int
findLastInScope
(String name) private int
private int
findLastInTableScope
(String name) private int
private int
private int
findLastOrRoot
(int group) private int
findLastOrRoot
(String name) final void
Flushes the pending characters.private void
private void
Returns the deepTreeSurrogateParent.Returns the errorHandler.Returns the formPointer.Returns the headPointer.Returns the listOfActiveFormattingElements.int
Return the length of the list of active formatting elements.int
getMode()
Returns the mode.int
Returns the originalMode.getStack()
Returns the stack.int
Return the length of the stack.protected abstract boolean
hasChildren
(T element) private void
protected abstract void
insertFosterParentedCharacters
(char[] buf, int start, int length, T table, T stackParent) protected abstract void
insertFosterParentedChild
(T child, T table, T stackParent) private void
insertIntoFosterParent
(T child) private void
insertIntoListOfActiveFormattingElements
(StackNode<T> formattingClone, int bookmark) private void
insertIntoStack
(StackNode<T> node, int position) private void
private boolean
isAlmostStandards
(String publicIdentifier, String systemIdentifier) private boolean
boolean
Returns the framesetOk.private boolean
isHtml4Doctype
(String publicIdentifier) private boolean
private boolean
private boolean
boolean
Returns the needToDropLF.boolean
isQuirks()
Returns the quirks.private boolean
boolean
Returns the scriptingEnabled.private boolean
private boolean
isSpecialParentInForeign
(StackNode<T> stackNode) void
loadState
(TreeBuilderState<T> snapshot, Interner interner) protected void
markMalformedIfScript
(T elt) private void
maybeForgetEarlierDuplicateFormattingElement
(String name, HtmlAttributes attributes) Creates a comparable snapshot of the tree builder state.private void
pop()
private void
popOnEof()
private void
private void
private void
private void
private void
removeFromStack
(int pos) private void
removeFromStack
(StackNode<T> node) private final void
reportUnclosedElementNameAndLocation
(int pos) Reports the name and location of an unclosed element.protected final void
private void
void
setDoctypeExpectation
(DoctypeExpectation doctypeExpectation) Sets the doctypeExpectation.void
setDocumentModeHandler
(DocumentModeHandler documentModeHandler) Sets the documentModeHandler.final void
setErrorHandler
(ErrorHandler errorHandler) Sets the errorHandler.final void
setFragmentContext
(String context) The argument MUST be an interned string ornull
.final void
setFragmentContext
(String context, String ns, T node, boolean quirks) The argument MUST be an interned string ornull
.void
setIgnoringComments
(boolean ignoreComments) void
setNamePolicy
(XmlViolationPolicy namePolicy) void
setReportingDoctype
(boolean reportingDoctype) Sets the reportingDoctype.void
setScriptingEnabled
(boolean scriptingEnabled) Sets the scriptingEnabled.private void
private void
silentPush
(StackNode<T> node) boolean
snapshotMatches
(TreeBuilderState<T> snapshot) protected void
start
(boolean fragmentMode) final void
startTag
(ElementName elementName, HtmlAttributes attributes, boolean selfClosing) Receive a start tag token.final void
startTokenization
(Tokenizer self) This method is called at the start of tokenization before any other methods on this interface are called.boolean
If this handler implementation cares about comments, returntrue
.(package private) final void
Reports a warning(package private) final void
Reports a warning with an explicit locatorvoid
Reports 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:
SAXException
SAXParseException
-
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:TokenHandler
This method is called at the start of tokenization before any other methods on this interface are called. Implementations should hold the reference to theTokenizer
in order to set the content model flag and in order to be able to query forLocator
data.- Specified by:
startTokenization
in 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:TokenHandler
Receive a doctype token.- Specified by:
doctype
in 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:TokenHandler
Receive a comment token. The data is junk if thewantsComments()
returnedfalse
.- Specified by:
comment
in 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:TokenHandler
Receive character tokens. This method has the same semantics as the SAX method of the same name.- Specified by:
characters
in 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:TokenHandler
Reports a U+0000 that's being turned into a U+FFFD.- Specified by:
zeroOriginatingReplacementCharacter
in interfaceTokenHandler
- Throws:
SAXException
- if something went wrong- See Also:
-
eof
Description copied from interface:TokenHandler
The end-of-file token.- Specified by:
eof
in interfaceTokenHandler
- Throws:
SAXException
- if something went wrong
-
endTokenization
Description copied from interface:TokenHandler
The perform final cleanup.- Specified by:
endTokenization
in 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:TokenHandler
Receive a start tag token.- Specified by:
startTag
in interfaceTokenHandler
- Parameters:
elementName
- the tag nameattributes
- the attributesselfClosing
- TODO- Throws:
SAXException
- if something went wrong
-
isSpecialParentInForeign
-
extractCharsetFromContent
C++ memory note: The return value must be released.
- Returns:
-
checkMetaCharset
- Throws:
SAXException
-
endTag
Description copied from interface:TokenHandler
Receive an end tag token.- Specified by:
endTag
in 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:
true
iff 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:TokenHandler
If this handler implementation cares about comments, returntrue
. If not, returnfalse
.- Specified by:
wantsComments
in 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
Returns the errorHandler.- Returns:
- the errorHandler
-
setFragmentContext
The argument MUST be an interned string ornull
.- Parameters:
context
-
-
cdataSectionAllowed
Description copied from interface:TokenHandler
Checks if the CDATA sections are allowed.- Specified by:
cdataSectionAllowed
in interfaceTokenHandler
- Returns:
true
if CDATA sections are allowed- Throws:
SAXException
- if something went wrong- See Also:
-
isInForeign
private boolean isInForeign() -
isInForeignButNotHtmlOrMathTextIntegrationPoint
private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint() -
setFragmentContext
The argument MUST be an interned string ornull
.- Parameters:
context
-
-
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 callingdelete
on the returned object.- Returns:
- a snapshot.
- Throws:
SAXException
-
snapshotMatches
-
loadState
- Throws:
SAXException
-
findInArray
-
getFormPointer
Description copied from interface:TreeBuilderState
Returns the formPointer.- Specified by:
getFormPointer
in interfaceTreeBuilderState<T>
- Returns:
- the formPointer
- See Also:
-
getHeadPointer
Returns the headPointer.- Specified by:
getHeadPointer
in interfaceTreeBuilderState<T>
- Returns:
- the headPointer
-
getDeepTreeSurrogateParent
Returns the deepTreeSurrogateParent.- Specified by:
getDeepTreeSurrogateParent
in interfaceTreeBuilderState<T>
- Returns:
- the deepTreeSurrogateParent
-
getListOfActiveFormattingElements
Description copied from interface:TreeBuilderState
Returns the listOfActiveFormattingElements.- Specified by:
getListOfActiveFormattingElements
in interfaceTreeBuilderState<T>
- Returns:
- the listOfActiveFormattingElements
- See Also:
-
getStack
Description copied from interface:TreeBuilderState
Returns the stack.- Specified by:
getStack
in interfaceTreeBuilderState<T>
- Returns:
- the stack
- See Also:
-
getMode
public int getMode()Returns the mode.- Specified by:
getMode
in interfaceTreeBuilderState<T>
- Returns:
- the mode
-
getOriginalMode
public int getOriginalMode()Returns the originalMode.- Specified by:
getOriginalMode
in interfaceTreeBuilderState<T>
- Returns:
- the originalMode
-
isFramesetOk
public boolean isFramesetOk()Returns the framesetOk.- Specified by:
isFramesetOk
in interfaceTreeBuilderState<T>
- Returns:
- the framesetOk
-
isNeedToDropLF
public boolean isNeedToDropLF()Returns the needToDropLF.- Specified by:
isNeedToDropLF
in interfaceTreeBuilderState<T>
- Returns:
- the needToDropLF
-
isQuirks
public boolean isQuirks()Returns the quirks.- Specified by:
isQuirks
in interfaceTreeBuilderState<T>
- Returns:
- the quirks
-
getListOfActiveFormattingElementsLength
public int getListOfActiveFormattingElementsLength()Description copied from interface:TreeBuilderState
Return the length of the list of active formatting elements.- Specified by:
getListOfActiveFormattingElementsLength
in interfaceTreeBuilderState<T>
- Returns:
- the length of the list of active formatting elements.
- See Also:
-
getStackLength
public int getStackLength()Description copied from interface:TreeBuilderState
Return the length of the stack.- Specified by:
getStackLength
in 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
-