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
public abstract class TreeBuilder<T> extends java.lang.Object implements TokenHandler, TreeBuilderState<T>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
A
(package private) static 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
private static int
AFTER_AFTER_BODY
private static int
AFTER_AFTER_FRAMESET
private static int
AFTER_BODY
private static int
AFTER_FRAMESET
private static int
AFTER_HEAD
(package private) static int
ANNOTATION_XML
(package private) static int
AREA_OR_WBR
(package private) static int
B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U
(package private) static int
BASE
private static int
BEFORE_HEAD
private static int
BEFORE_HTML
(package private) static int
BODY
(package private) static int
BR
(package private) static int
BUTTON
(package private) static int
CAPTION
protected char[]
charBuffer
protected int
charBufferLen
private static int
CHARSET_A
private static int
CHARSET_C
private static int
CHARSET_DOUBLE_QUOTED
private static int
CHARSET_E
private static int
CHARSET_EQUALS
private static int
CHARSET_H
private static int
CHARSET_INITIAL
private static int
CHARSET_R
private static int
CHARSET_S
private static int
CHARSET_SINGLE_QUOTED
private static int
CHARSET_T
private static int
CHARSET_UNQUOTED
(package private) static int
COL
(package private) static int
COLGROUP
(package private) static int
COMMAND
private java.lang.String
contextName
private java.lang.String
contextNamespace
private T
contextNode
private int
currentPtr
(package private) static int
DD_OR_DT
private T
deepTreeSurrogateParent
Used to work around Gecko limitations.(package private) static int
DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU
private DoctypeExpectation
doctypeExpectation
private DocumentModeHandler
documentModeHandler
(package private) static int
EMBED_OR_IMG
protected org.xml.sax.ErrorHandler
errorHandler
(package private) static int
FIELDSET
private LocatorImpl
firstCommentLocation
(package private) static int
FONT
(package private) static int
FOREIGNOBJECT_OR_DESC
(package private) static int
FORM
private T
formPointer
private boolean
fragment
(package private) static int
FRAME
(package private) static int
FRAMESET
private static int
FRAMESET_OK
private boolean
framesetOk
Used only when moving back to IN_BODY.(package private) static int
H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6
(package private) static int
HEAD
private T
headPointer
(package private) static int
HR
(package private) static int
HTML
private static java.lang.String
HTML_LOCAL
private boolean
html4
private static java.lang.String[]
HTML4_PUBLIC_IDS
private java.util.Map<java.lang.String,LocatorImpl>
idLocations
(package private) static int
IFRAME
(package private) static int
IMAGE
private static int
IN_BODY
private static int
IN_CAPTION
private static int
IN_CELL
private static int
IN_COLUMN_GROUP
private static int
IN_FRAMESET
private static int
IN_HEAD
private static int
IN_HEAD_NOSCRIPT
private static int
IN_ROW
private static int
IN_SELECT
private static int
IN_SELECT_IN_TABLE
private static int
IN_TABLE
private static int
IN_TABLE_BODY
private static int
INITIAL
(package private) static int
INPUT
(package private) static int
ISINDEX
(package private) static int
KEYGEN
(package private) static int
LI
(package private) static int
LINK_OR_BASEFONT_OR_BGSOUND
private StackNode<T>[]
listOfActiveFormattingElements
private int
listPtr
(package private) static int
MARQUEE_OR_APPLET
(package private) static int
MATH
(package private) static int
MENUITEM
(package private) static int
META
(package private) static int
MGLYPH_OR_MALIGNMARK
(package private) static int
MI_MO_MN_MS_MTEXT
private int
mode
private XmlViolationPolicy
namePolicy
private boolean
needToDropLF
(package private) static int
NOBR
(package private) static int
NOEMBED
(package private) static int
NOFRAMES
(package private) static int
NOSCRIPT
private static int
NOT_FOUND_ON_STACK
(package private) static int
OBJECT
(package private) static int
OPTGROUP
(package private) static int
OPTION
private int
originalMode
(package private) static int
OTHER
(package private) static int
OUTPUT_OR_LABEL
(package private) static int
P
(package private) static int
PARAM_OR_SOURCE_OR_TRACK
(package private) static int
PLAINTEXT
(package private) static int
PRE_OR_LISTING
private boolean
quirks
private static java.lang.String[]
QUIRKY_PUBLIC_IDS
private static char[]
REPLACEMENT_CHARACTER
Array version of U+FFFD.private boolean
reportingDoctype
(package private) static int
RT_OR_RP
(package private) static int
RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR
(package private) static int
SCRIPT
private boolean
scriptingEnabled
(package private) static int
SELECT
private StackNode<T>[]
stack
(package private) static int
STYLE
(package private) static int
SVG
(package private) static int
TABLE
(package private) static int
TBODY_OR_THEAD_OR_TFOOT
(package private) static int
TD_OR_TH
private static int
TEXT
(package private) static int
TEXTAREA
(package private) static int
TITLE
protected Tokenizer
tokenizer
(package private) static int
TR
(package private) static int
UL_OR_OL_OR_DL
private boolean
wantingComments
(package private) static int
XMP
-
Constructor Summary
Constructors Modifier Constructor Description protected
TreeBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
accumulateCharacters(char[] buf, int start, int length)
private 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(java.lang.String name)
private boolean
annotationXmlEncodingPermitsHtml(HtmlAttributes attributes)
private void
append(StackNode<T> node)
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(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier)
protected abstract void
appendElement(T child, T newParent)
private void
appendHtmlElementToDocumentAndPush()
private void
appendHtmlElementToDocumentAndPush(HtmlAttributes attributes)
protected abstract void
appendIsindexPrompt(T parent)
private void
appendToCurrentNodeAndPushBodyElement()
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
appendToCurrentNodeAndPushFormElementMayFoster(HtmlAttributes attributes)
private void
appendToCurrentNodeAndPushHeadElement(HtmlAttributes attributes)
private void
appendVoidElementToCurrent(java.lang.String name, HtmlAttributes attributes, T form)
private void
appendVoidElementToCurrentMayFoster(java.lang.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
cdataSectionAllowed()
Checks if the CDATA sections are allowed.void
characters(char[] buf, int start, int length)
Receive character tokens.private boolean
charBufferContainsNonWhitespace()
private void
checkAttributes(HtmlAttributes attributes, java.lang.String ns)
private void
checkMetaCharset(HtmlAttributes attributes)
private java.lang.String
checkPopName(java.lang.String name)
private boolean
clearLastListSlot()
private boolean
clearLastStackSlot()
private void
clearStackBackTo(int eltPos)
private void
clearTheListOfActiveFormattingElementsUpToTheLastMarker()
private void
closeTheCell(int eltPos)
void
comment(char[] buf, int start, int length)
Receive a comment token.protected abstract T
createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes)
protected T
createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes, T form)
protected abstract T
createHtmlElementSetAsRoot(HtmlAttributes attributes)
protected T
currentNode()
protected abstract void
detachFromParent(T element)
void
doctype(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean forceQuirks)
Receive a doctype token.protected void
documentMode(DocumentMode m, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
private void
documentModeInternal(DocumentMode m, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
protected void
elementPopped(java.lang.String ns, java.lang.String name, T node)
protected void
elementPushed(java.lang.String ns, java.lang.String name, T node)
protected void
end()
void
endTag(ElementName elementName)
Receive an end tag token.void
endTokenization()
The perform final cleanup.void
eof()
The end-of-file token.(package private) void
err(java.lang.String message)
Reports a Parse Error.private void
errAlmostStandardsDoctype()
private void
errBadStartTagInHead(java.lang.String name)
private void
errEndTagAfterBody()
private void
errEndTagBr()
private void
errEndTagDidNotMatchCurrentOpenElement(java.lang.String name, java.lang.String currOpenName)
private void
errEndTagSeenWithoutDoctype()
private void
errEndTagSeenWithSelectOpen(java.lang.String name)
private void
errEndTagViolatesNestingRules(java.lang.String name)
private void
errEndWithUnclosedElements(java.lang.String name)
Reports arriving at/near end of document with unclosed elements remaining.private void
errEofWithUnclosedElements()
private void
errFooBetweenHeadAndBody(java.lang.String name)
private void
errFooSeenWhenFooOpen(java.lang.String name)
private void
errFormWhenFormOpen()
private void
errFramesetStart()
private void
errGarbageInColgroup()
private void
errHeadingWhenHeadingOpen()
private void
errHtmlStartTagInForeignContext(java.lang.String name)
private void
errImage()
private void
errIsindex()
private void
errListUnclosedStartTags(int eltPos)
private void
errNoCellToClose()
(package private) void
errNoCheck(java.lang.String message)
Reports a Parse Error without checking if an error handler is present.private void
errNoCheckUnclosedElementsOnStack()
private void
errNoElementToCloseButEndTagSeen(java.lang.String name)
private void
errNonSpaceAfterBody()
private void
errNonSpaceAfterFrameset()
private void
errNonSpaceInColgroupInFragment()
private void
errNonSpaceInFrameset()
private void
errNonSpaceInNoscriptInHead()
private void
errNonSpaceInTable()
private void
errNonSpaceInTrailer()
private void
errNoSelectInTableScope()
private void
errNoTableRowToClose()
private void
errQuirkyDoctype()
private void
errSelfClosing()
private void
errStartSelectWhereEndSelectExpected()
private void
errStartTagInTable(java.lang.String name)
private void
errStartTagInTableBody(java.lang.String name)
private void
errStartTagSeenWithoutRuby(java.lang.String name)
private void
errStartTagWithoutDoctype()
private void
errStartTagWithSelectOpen(java.lang.String name)
private void
errStrayDoctype()
private void
errStrayEndTag(java.lang.String name)
Reports a stray end tag.private void
errStrayStartTag(java.lang.String name)
Reports a stray start tag.private void
errTableClosedWhileCaptionOpen()
private void
errTableSeenWhileTableOpen()
private void
errUnclosedChildrenInRuby()
private void
errUnclosedElements(int eltPos, java.lang.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, java.lang.String name)
Reports a state when elements expected to be closed ahead of an implied end tag but were not.static java.lang.String
extractCharsetFromContent(java.lang.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 void
fatal(java.lang.Exception e)
(package private) void
fatal(java.lang.String s)
private int
findInArray(StackNode<T> node, StackNode<T>[] arr)
private int
findInListOfActiveFormattingElements(StackNode<T> node)
private int
findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(java.lang.String name)
private int
findLast(java.lang.String name)
private int
findLastInButtonScope(java.lang.String name)
private int
findLastInListScope(java.lang.String name)
private int
findLastInScope(java.lang.String name)
private int
findLastInScopeHn()
private int
findLastInTableScope(java.lang.String name)
private int
findLastInTableScopeOrRootTbodyTheadTfoot()
private int
findLastInTableScopeTdTh()
private int
findLastOrRoot(int group)
private int
findLastOrRoot(java.lang.String name)
void
flushCharacters()
Flushes the pending characters.private void
generateImpliedEndTags()
private void
generateImpliedEndTagsExceptFor(java.lang.String name)
T
getDeepTreeSurrogateParent()
Returns the deepTreeSurrogateParent.org.xml.sax.ErrorHandler
getErrorHandler()
Returns the errorHandler.T
getFormPointer()
Returns the formPointer.T
getHeadPointer()
Returns the headPointer.StackNode<T>[]
getListOfActiveFormattingElements()
Returns the listOfActiveFormattingElements.int
getListOfActiveFormattingElementsLength()
Return the length of the list of active formatting elements.int
getMode()
Returns the mode.int
getOriginalMode()
Returns the originalMode.StackNode<T>[]
getStack()
Returns the stack.int
getStackLength()
Return the length of the stack.protected abstract boolean
hasChildren(T element)
private void
implicitlyCloseP()
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
insertMarker()
private boolean
isAlmostStandards(java.lang.String publicIdentifier, java.lang.String systemIdentifier)
private boolean
isCurrent(java.lang.String name)
boolean
isFramesetOk()
Returns the framesetOk.private boolean
isHtml4Doctype(java.lang.String publicIdentifier)
private boolean
isInForeign()
private boolean
isInForeignButNotHtmlOrMathTextIntegrationPoint()
private boolean
isInStack(StackNode<T> node)
boolean
isNeedToDropLF()
Returns the needToDropLF.boolean
isQuirks()
Returns the quirks.private boolean
isQuirky(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean forceQuirks)
boolean
isScriptingEnabled()
Returns the scriptingEnabled.private boolean
isSecondOnStackBody()
private boolean
isSpecialParentInForeign(StackNode<T> stackNode)
void
loadState(TreeBuilderState<T> snapshot, Interner interner)
protected void
markMalformedIfScript(T elt)
private void
maybeForgetEarlierDuplicateFormattingElement(java.lang.String name, HtmlAttributes attributes)
TreeBuilderState<T>
newSnapshot()
Creates a comparable snapshot of the tree builder state.private void
pop()
private void
popOnEof()
private void
push(StackNode<T> node)
private void
pushHeadPointerOntoStack()
private void
reconstructTheActiveFormattingElements()
private void
removeFromListOfActiveFormattingElements(int pos)
private void
removeFromStack(int pos)
private void
removeFromStack(StackNode<T> node)
private void
reportUnclosedElementNameAndLocation(int pos)
Reports the name and location of an unclosed element.protected void
requestSuspension()
private void
resetTheInsertionMode()
void
setDoctypeExpectation(DoctypeExpectation doctypeExpectation)
Sets the doctypeExpectation.void
setDocumentModeHandler(DocumentModeHandler documentModeHandler)
Sets the documentModeHandler.void
setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Sets the errorHandler.void
setFragmentContext(java.lang.String context)
The argument MUST be an interned string ornull
.void
setFragmentContext(java.lang.String context, java.lang.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
silentPop()
private void
silentPush(StackNode<T> node)
boolean
snapshotMatches(TreeBuilderState<T> snapshot)
protected void
start(boolean fragmentMode)
void
startTag(ElementName elementName, HtmlAttributes attributes, boolean selfClosing)
Receive a start tag token.void
startTokenization(Tokenizer self)
This method is called at the start of tokenization before any other methods on this interface are called.boolean
wantsComments()
If this handler implementation cares about comments, returntrue
.(package private) void
warn(java.lang.String message)
Reports a warning(package private) void
warn(java.lang.String message, org.xml.sax.Locator locator)
Reports a warning with an explicit locatorvoid
zeroOriginatingReplacementCharacter()
Reports a U+0000 that's being turned into a U+FFFD.
-
-
-
Field Detail
-
REPLACEMENT_CHARACTER
private static final char[] REPLACEMENT_CHARACTER
Array version of U+FFFD.
-
OTHER
static final int OTHER
- See Also:
- Constant Field Values
-
A
static final int A
- See Also:
- Constant Field Values
-
BASE
static final int BASE
- See Also:
- Constant Field Values
-
BODY
static final int BODY
- See Also:
- Constant Field Values
-
BR
static final int BR
- See Also:
- Constant Field Values
-
BUTTON
static final int BUTTON
- See Also:
- Constant Field Values
-
CAPTION
static final int CAPTION
- See Also:
- Constant Field Values
-
COL
static final int COL
- See Also:
- Constant Field Values
-
COLGROUP
static final int COLGROUP
- See Also:
- Constant Field Values
-
FORM
static final int FORM
- See Also:
- Constant Field Values
-
FRAME
static final int FRAME
- See Also:
- Constant Field Values
-
FRAMESET
static final int FRAMESET
- See Also:
- Constant Field Values
-
IMAGE
static final int IMAGE
- See Also:
- Constant Field Values
-
INPUT
static final int INPUT
- See Also:
- Constant Field Values
-
ISINDEX
static final int ISINDEX
- See Also:
- Constant Field Values
-
LI
static final int LI
- See Also:
- Constant Field Values
-
LINK_OR_BASEFONT_OR_BGSOUND
static final int LINK_OR_BASEFONT_OR_BGSOUND
- See Also:
- Constant Field Values
-
MATH
static final int MATH
- See Also:
- Constant Field Values
-
META
static final int META
- See Also:
- Constant Field Values
-
SVG
static final int SVG
- See Also:
- Constant Field Values
-
HEAD
static final int HEAD
- See Also:
- Constant Field Values
-
HR
static final int HR
- See Also:
- Constant Field Values
-
HTML
static final int HTML
- See Also:
- Constant Field Values
-
NOBR
static final int NOBR
- See Also:
- Constant Field Values
-
NOFRAMES
static final int NOFRAMES
- See Also:
- Constant Field Values
-
NOSCRIPT
static final int NOSCRIPT
- See Also:
- Constant Field Values
-
OPTGROUP
static final int OPTGROUP
- See Also:
- Constant Field Values
-
OPTION
static final int OPTION
- See Also:
- Constant Field Values
-
P
static final int P
- See Also:
- Constant Field Values
-
PLAINTEXT
static final int PLAINTEXT
- See Also:
- Constant Field Values
-
SCRIPT
static final int SCRIPT
- See Also:
- Constant Field Values
-
SELECT
static final int SELECT
- See Also:
- Constant Field Values
-
STYLE
static final int STYLE
- See Also:
- Constant Field Values
-
TABLE
static final int TABLE
- See Also:
- Constant Field Values
-
TEXTAREA
static final int TEXTAREA
- See Also:
- Constant Field Values
-
TITLE
static final int TITLE
- See Also:
- Constant Field Values
-
TR
static final int TR
- See Also:
- Constant Field Values
-
XMP
static final int XMP
- See Also:
- Constant Field Values
-
TBODY_OR_THEAD_OR_TFOOT
static final int TBODY_OR_THEAD_OR_TFOOT
- See Also:
- Constant Field Values
-
TD_OR_TH
static final int TD_OR_TH
- See Also:
- Constant Field Values
-
DD_OR_DT
static final int DD_OR_DT
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
MARQUEE_OR_APPLET
static final int MARQUEE_OR_APPLET
- See Also:
- Constant Field Values
-
PRE_OR_LISTING
static final int PRE_OR_LISTING
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
UL_OR_OL_OR_DL
static final int UL_OR_OL_OR_DL
- See Also:
- Constant Field Values
-
IFRAME
static final int IFRAME
- See Also:
- Constant Field Values
-
EMBED_OR_IMG
static final int EMBED_OR_IMG
- See Also:
- Constant Field Values
-
AREA_OR_WBR
static final int AREA_OR_WBR
- See Also:
- Constant Field Values
-
DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU
static final int DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR
static final int RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR
- See Also:
- Constant Field Values
-
RT_OR_RP
static final int RT_OR_RP
- See Also:
- Constant Field Values
-
COMMAND
static final int COMMAND
- See Also:
- Constant Field Values
-
PARAM_OR_SOURCE_OR_TRACK
static final int PARAM_OR_SOURCE_OR_TRACK
- See Also:
- Constant Field Values
-
MGLYPH_OR_MALIGNMARK
static final int MGLYPH_OR_MALIGNMARK
- See Also:
- Constant Field Values
-
MI_MO_MN_MS_MTEXT
static final int MI_MO_MN_MS_MTEXT
- See Also:
- Constant Field Values
-
ANNOTATION_XML
static final int ANNOTATION_XML
- See Also:
- Constant Field Values
-
FOREIGNOBJECT_OR_DESC
static final int FOREIGNOBJECT_OR_DESC
- See Also:
- Constant Field Values
-
NOEMBED
static final int NOEMBED
- See Also:
- Constant Field Values
-
FIELDSET
static final int FIELDSET
- See Also:
- Constant Field Values
-
OUTPUT_OR_LABEL
static final int OUTPUT_OR_LABEL
- See Also:
- Constant Field Values
-
OBJECT
static final int OBJECT
- See Also:
- Constant Field Values
-
FONT
static final int FONT
- See Also:
- Constant Field Values
-
KEYGEN
static final int KEYGEN
- See Also:
- Constant Field Values
-
MENUITEM
static final int MENUITEM
- See Also:
- Constant Field Values
-
INITIAL
private static final int INITIAL
- See Also:
- Constant Field Values
-
BEFORE_HTML
private static final int BEFORE_HTML
- See Also:
- Constant Field Values
-
BEFORE_HEAD
private static final int BEFORE_HEAD
- See Also:
- Constant Field Values
-
IN_HEAD
private static final int IN_HEAD
- See Also:
- Constant Field Values
-
IN_HEAD_NOSCRIPT
private static final int IN_HEAD_NOSCRIPT
- See Also:
- Constant Field Values
-
AFTER_HEAD
private static final int AFTER_HEAD
- See Also:
- Constant Field Values
-
IN_BODY
private static final int IN_BODY
- See Also:
- Constant Field Values
-
IN_TABLE
private static final int IN_TABLE
- See Also:
- Constant Field Values
-
IN_CAPTION
private static final int IN_CAPTION
- See Also:
- Constant Field Values
-
IN_COLUMN_GROUP
private static final int IN_COLUMN_GROUP
- See Also:
- Constant Field Values
-
IN_TABLE_BODY
private static final int IN_TABLE_BODY
- See Also:
- Constant Field Values
-
IN_ROW
private static final int IN_ROW
- See Also:
- Constant Field Values
-
IN_CELL
private static final int IN_CELL
- See Also:
- Constant Field Values
-
IN_SELECT
private static final int IN_SELECT
- See Also:
- Constant Field Values
-
IN_SELECT_IN_TABLE
private static final int IN_SELECT_IN_TABLE
- See Also:
- Constant Field Values
-
AFTER_BODY
private static final int AFTER_BODY
- See Also:
- Constant Field Values
-
IN_FRAMESET
private static final int IN_FRAMESET
- See Also:
- Constant Field Values
-
AFTER_FRAMESET
private static final int AFTER_FRAMESET
- See Also:
- Constant Field Values
-
AFTER_AFTER_BODY
private static final int AFTER_AFTER_BODY
- See Also:
- Constant Field Values
-
AFTER_AFTER_FRAMESET
private static final int AFTER_AFTER_FRAMESET
- See Also:
- Constant Field Values
-
TEXT
private static final int TEXT
- See Also:
- Constant Field Values
-
FRAMESET_OK
private static final int FRAMESET_OK
- See Also:
- Constant Field Values
-
CHARSET_INITIAL
private static final int CHARSET_INITIAL
- See Also:
- Constant Field Values
-
CHARSET_C
private static final int CHARSET_C
- See Also:
- Constant Field Values
-
CHARSET_H
private static final int CHARSET_H
- See Also:
- Constant Field Values
-
CHARSET_A
private static final int CHARSET_A
- See Also:
- Constant Field Values
-
CHARSET_R
private static final int CHARSET_R
- See Also:
- Constant Field Values
-
CHARSET_S
private static final int CHARSET_S
- See Also:
- Constant Field Values
-
CHARSET_E
private static final int CHARSET_E
- See Also:
- Constant Field Values
-
CHARSET_T
private static final int CHARSET_T
- See Also:
- Constant Field Values
-
CHARSET_EQUALS
private static final int CHARSET_EQUALS
- See Also:
- Constant Field Values
-
CHARSET_SINGLE_QUOTED
private static final int CHARSET_SINGLE_QUOTED
- See Also:
- Constant Field Values
-
CHARSET_DOUBLE_QUOTED
private static final int CHARSET_DOUBLE_QUOTED
- See Also:
- Constant Field Values
-
CHARSET_UNQUOTED
private static final int CHARSET_UNQUOTED
- See Also:
- Constant Field Values
-
HTML4_PUBLIC_IDS
private static final java.lang.String[] HTML4_PUBLIC_IDS
-
QUIRKY_PUBLIC_IDS
private static final java.lang.String[] QUIRKY_PUBLIC_IDS
-
NOT_FOUND_ON_STACK
private static final int NOT_FOUND_ON_STACK
- See Also:
- Constant Field Values
-
HTML_LOCAL
private static final java.lang.String HTML_LOCAL
- See Also:
- Constant Field Values
-
mode
private int mode
-
originalMode
private int originalMode
-
framesetOk
private boolean framesetOk
Used only when moving back to IN_BODY.
-
tokenizer
protected Tokenizer tokenizer
-
errorHandler
protected org.xml.sax.ErrorHandler errorHandler
-
documentModeHandler
private DocumentModeHandler documentModeHandler
-
doctypeExpectation
private DoctypeExpectation doctypeExpectation
-
firstCommentLocation
private LocatorImpl firstCommentLocation
-
scriptingEnabled
private boolean scriptingEnabled
-
needToDropLF
private boolean needToDropLF
-
wantingComments
private boolean wantingComments
-
fragment
private boolean fragment
-
contextName
private java.lang.String contextName
-
contextNamespace
private java.lang.String contextNamespace
-
contextNode
private T contextNode
-
currentPtr
private int currentPtr
-
listPtr
private int listPtr
-
formPointer
private T formPointer
-
headPointer
private T headPointer
-
deepTreeSurrogateParent
private T 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
private XmlViolationPolicy namePolicy
-
idLocations
private final java.util.Map<java.lang.String,LocatorImpl> idLocations
-
html4
private boolean html4
-
-
Method Detail
-
fatal
protected void fatal() throws org.xml.sax.SAXException
Reports an condition that would make the infoset incompatible with XML 1.0 as fatal.- Throws:
org.xml.sax.SAXException
org.xml.sax.SAXParseException
-
fatal
protected final void fatal(java.lang.Exception e) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
fatal
final void fatal(java.lang.String s) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
err
final void err(java.lang.String message) throws org.xml.sax.SAXException
Reports a Parse Error.- Parameters:
message
- the message- Throws:
org.xml.sax.SAXException
-
errNoCheck
final void errNoCheck(java.lang.String message) throws org.xml.sax.SAXException
Reports a Parse Error without checking if an error handler is present.- Parameters:
message
- the message- Throws:
org.xml.sax.SAXException
-
errListUnclosedStartTags
private void errListUnclosedStartTags(int eltPos) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
reportUnclosedElementNameAndLocation
private final void reportUnclosedElementNameAndLocation(int pos) throws org.xml.sax.SAXException
Reports the name and location of an unclosed element.- Throws:
org.xml.sax.SAXException
-
warn
final void warn(java.lang.String message) throws org.xml.sax.SAXException
Reports a warning- Parameters:
message
- the message- Throws:
org.xml.sax.SAXException
-
warn
final void warn(java.lang.String message, org.xml.sax.Locator locator) throws org.xml.sax.SAXException
Reports a warning with an explicit locator- Parameters:
message
- the message- Throws:
org.xml.sax.SAXException
-
startTokenization
public final void startTokenization(Tokenizer self) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
- if something went wrong
-
doctype
public final void doctype(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean forceQuirks) throws org.xml.sax.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:
org.xml.sax.SAXException
- if something went wrong
-
isHtml4Doctype
private boolean isHtml4Doctype(java.lang.String publicIdentifier)
-
comment
public final void comment(char[] buf, int start, int length) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
- if something went wrong
-
characters
public final void characters(char[] buf, int start, int length) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
- if something went wrong- See Also:
TokenHandler.characters(char[], int, int)
-
zeroOriginatingReplacementCharacter
public void zeroOriginatingReplacementCharacter() throws org.xml.sax.SAXException
Description copied from interface:TokenHandler
Reports a U+0000 that's being turned into a U+FFFD.- Specified by:
zeroOriginatingReplacementCharacter
in interfaceTokenHandler
- Throws:
org.xml.sax.SAXException
- if something went wrong- See Also:
TokenHandler.zeroOriginatingReplacementCharacter()
-
eof
public final void eof() throws org.xml.sax.SAXException
Description copied from interface:TokenHandler
The end-of-file token.- Specified by:
eof
in interfaceTokenHandler
- Throws:
org.xml.sax.SAXException
- if something went wrong
-
endTokenization
public final void endTokenization() throws org.xml.sax.SAXException
Description copied from interface:TokenHandler
The perform final cleanup.- Specified by:
endTokenization
in interfaceTokenHandler
- Throws:
org.xml.sax.SAXException
- if something went wrong- See Also:
TokenHandler.endTokenization()
-
startTag
public final void startTag(ElementName elementName, HtmlAttributes attributes, boolean selfClosing) throws org.xml.sax.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:
org.xml.sax.SAXException
- if something went wrong
-
extractCharsetFromContent
public static java.lang.String extractCharsetFromContent(java.lang.String attributeValue)
C++ memory note: The return value must be released.
- Returns:
- Throws:
org.xml.sax.SAXException
StopSniffingException
-
checkMetaCharset
private void checkMetaCharset(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
endTag
public final void endTag(ElementName elementName) throws org.xml.sax.SAXException
Description copied from interface:TokenHandler
Receive an end tag token.- Specified by:
endTag
in interfaceTokenHandler
- Parameters:
elementName
- the tag name- Throws:
org.xml.sax.SAXException
- if something went wrong
-
findLastInTableScopeOrRootTbodyTheadTfoot
private int findLastInTableScopeOrRootTbodyTheadTfoot()
-
findLast
private int findLast(java.lang.String name)
-
findLastInTableScope
private int findLastInTableScope(java.lang.String name)
-
findLastInButtonScope
private int findLastInButtonScope(java.lang.String name)
-
findLastInScope
private int findLastInScope(java.lang.String name)
-
findLastInListScope
private int findLastInListScope(java.lang.String name)
-
findLastInScopeHn
private int findLastInScopeHn()
-
generateImpliedEndTagsExceptFor
private void generateImpliedEndTagsExceptFor(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
generateImpliedEndTags
private void generateImpliedEndTags() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
isSecondOnStackBody
private boolean isSecondOnStackBody()
-
documentModeInternal
private void documentModeInternal(DocumentMode m, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
isAlmostStandards
private boolean isAlmostStandards(java.lang.String publicIdentifier, java.lang.String systemIdentifier)
-
isQuirky
private boolean isQuirky(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean forceQuirks)
-
closeTheCell
private void closeTheCell(int eltPos) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
findLastInTableScopeTdTh
private int findLastInTableScopeTdTh()
-
clearStackBackTo
private void clearStackBackTo(int eltPos) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
resetTheInsertionMode
private void resetTheInsertionMode()
-
implicitlyCloseP
private void implicitlyCloseP() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
clearLastStackSlot
private boolean clearLastStackSlot()
-
clearLastListSlot
private boolean clearLastListSlot()
-
push
private void push(StackNode<T> node) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
silentPush
private void silentPush(StackNode<T> node) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
insertMarker
private void insertMarker()
-
clearTheListOfActiveFormattingElementsUpToTheLastMarker
private void clearTheListOfActiveFormattingElementsUpToTheLastMarker()
-
isCurrent
private boolean isCurrent(java.lang.String name)
-
removeFromStack
private void removeFromStack(int pos) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
removeFromStack
private void removeFromStack(StackNode<T> node) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
removeFromListOfActiveFormattingElements
private void removeFromListOfActiveFormattingElements(int pos)
-
adoptionAgencyEndTag
private boolean adoptionAgencyEndTag(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
insertIntoStack
private void insertIntoStack(StackNode<T> node, int position) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
insertIntoListOfActiveFormattingElements
private void insertIntoListOfActiveFormattingElements(StackNode<T> formattingClone, int bookmark)
-
findInListOfActiveFormattingElements
private int findInListOfActiveFormattingElements(StackNode<T> node)
-
findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker
private int findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(java.lang.String name)
-
maybeForgetEarlierDuplicateFormattingElement
private void maybeForgetEarlierDuplicateFormattingElement(java.lang.String name, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
findLastOrRoot
private int findLastOrRoot(java.lang.String name)
-
findLastOrRoot
private int findLastOrRoot(int group)
-
addAttributesToBody
private boolean addAttributesToBody(HtmlAttributes attributes) throws org.xml.sax.SAXException
Attempt to add attribute to the body element.- Parameters:
attributes
- the attributes- Returns:
true
iff the attributes were added- Throws:
org.xml.sax.SAXException
-
addAttributesToHtml
private void addAttributesToHtml(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
pushHeadPointerOntoStack
private void pushHeadPointerOntoStack() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
reconstructTheActiveFormattingElements
private void reconstructTheActiveFormattingElements() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
insertIntoFosterParent
private void insertIntoFosterParent(T child) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
pop
private void pop() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
silentPop
private void silentPop() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
popOnEof
private void popOnEof() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
checkAttributes
private void checkAttributes(HtmlAttributes attributes, java.lang.String ns) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
checkPopName
private java.lang.String checkPopName(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendHtmlElementToDocumentAndPush
private void appendHtmlElementToDocumentAndPush(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendHtmlElementToDocumentAndPush
private void appendHtmlElementToDocumentAndPush() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushHeadElement
private void appendToCurrentNodeAndPushHeadElement(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushBodyElement
private void appendToCurrentNodeAndPushBodyElement(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushBodyElement
private void appendToCurrentNodeAndPushBodyElement() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushFormElementMayFoster
private void appendToCurrentNodeAndPushFormElementMayFoster(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushFormattingElementMayFoster
private void appendToCurrentNodeAndPushFormattingElementMayFoster(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushElement
private void appendToCurrentNodeAndPushElement(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushElementMayFoster
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushElementMayFosterMathML
private void appendToCurrentNodeAndPushElementMayFosterMathML(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
annotationXmlEncodingPermitsHtml
private boolean annotationXmlEncodingPermitsHtml(HtmlAttributes attributes)
-
appendToCurrentNodeAndPushElementMayFosterSVG
private void appendToCurrentNodeAndPushElementMayFosterSVG(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendToCurrentNodeAndPushElementMayFoster
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendVoidElementToCurrentMayFoster
private void appendVoidElementToCurrentMayFoster(java.lang.String name, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendVoidElementToCurrentMayFoster
private void appendVoidElementToCurrentMayFoster(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendVoidElementToCurrentMayFosterSVG
private void appendVoidElementToCurrentMayFosterSVG(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendVoidElementToCurrentMayFosterMathML
private void appendVoidElementToCurrentMayFosterMathML(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendVoidElementToCurrent
private void appendVoidElementToCurrent(java.lang.String name, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendVoidFormToCurrent
private void appendVoidFormToCurrent(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
accumulateCharactersForced
private final void accumulateCharactersForced(char[] buf, int start, int length) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
accumulateCharacters
protected void accumulateCharacters(char[] buf, int start, int length) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
requestSuspension
protected final void requestSuspension()
-
createElement
protected abstract T createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
createElement
protected T createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
createHtmlElementSetAsRoot
protected abstract T createHtmlElementSetAsRoot(HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
detachFromParent
protected abstract void detachFromParent(T element) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
hasChildren
protected abstract boolean hasChildren(T element) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendElement
protected abstract void appendElement(T child, T newParent) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendChildrenToNewParent
protected abstract void appendChildrenToNewParent(T oldParent, T newParent) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
insertFosterParentedChild
protected abstract void insertFosterParentedChild(T child, T table, T stackParent) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
insertFosterParentedCharacters
protected abstract void insertFosterParentedCharacters(char[] buf, int start, int length, T table, T stackParent) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendCharacters
protected abstract void appendCharacters(T parent, char[] buf, int start, int length) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendIsindexPrompt
protected abstract void appendIsindexPrompt(T parent) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendComment
protected abstract void appendComment(T parent, char[] buf, int start, int length) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendCommentToDocument
protected abstract void appendCommentToDocument(char[] buf, int start, int length) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
addAttributesToElement
protected abstract void addAttributesToElement(T element, HtmlAttributes attributes) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
markMalformedIfScript
protected void markMalformedIfScript(T elt) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
start
protected void start(boolean fragmentMode) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
end
protected void end() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
appendDoctypeToDocument
protected void appendDoctypeToDocument(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
elementPushed
protected void elementPushed(java.lang.String ns, java.lang.String name, T node) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
elementPopped
protected void elementPopped(java.lang.String ns, java.lang.String name, T node) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
documentMode
protected void documentMode(DocumentMode m, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.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:
TokenHandler.wantsComments()
-
setIgnoringComments
public void setIgnoringComments(boolean ignoreComments)
-
setErrorHandler
public final void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Sets the errorHandler.- Parameters:
errorHandler
- the errorHandler to set
-
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
Returns the errorHandler.- Returns:
- the errorHandler
-
setFragmentContext
public final void setFragmentContext(java.lang.String context)
The argument MUST be an interned string ornull
.- Parameters:
context
-
-
cdataSectionAllowed
public boolean cdataSectionAllowed() throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
- if something went wrong- See Also:
TokenHandler.cdataSectionAllowed()
-
isInForeign
private boolean isInForeign()
-
isInForeignButNotHtmlOrMathTextIntegrationPoint
private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint()
-
setFragmentContext
public final void setFragmentContext(java.lang.String context, java.lang.String ns, T node, boolean quirks)
The argument MUST be an interned string ornull
.- Parameters:
context
-
-
currentNode
protected final T 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
public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation)
Sets the doctypeExpectation.- Parameters:
doctypeExpectation
- the doctypeExpectation to set
-
setNamePolicy
public void setNamePolicy(XmlViolationPolicy namePolicy)
-
setDocumentModeHandler
public void setDocumentModeHandler(DocumentModeHandler documentModeHandler)
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
public final void flushCharacters() throws org.xml.sax.SAXException
Flushes the pending characters. Public for document.write use cases only.- Throws:
org.xml.sax.SAXException
-
charBufferContainsNonWhitespace
private boolean charBufferContainsNonWhitespace()
-
newSnapshot
public TreeBuilderState<T> newSnapshot() throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
-
snapshotMatches
public boolean snapshotMatches(TreeBuilderState<T> snapshot)
-
loadState
public void loadState(TreeBuilderState<T> snapshot, Interner interner) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
getFormPointer
public T getFormPointer()
Description copied from interface:TreeBuilderState
Returns the formPointer.- Specified by:
getFormPointer
in interfaceTreeBuilderState<T>
- Returns:
- the formPointer
- See Also:
TreeBuilderState.getFormPointer()
-
getHeadPointer
public T getHeadPointer()
Returns the headPointer.- Specified by:
getHeadPointer
in interfaceTreeBuilderState<T>
- Returns:
- the headPointer
-
getDeepTreeSurrogateParent
public T getDeepTreeSurrogateParent()
Returns the deepTreeSurrogateParent.- Specified by:
getDeepTreeSurrogateParent
in interfaceTreeBuilderState<T>
- Returns:
- the deepTreeSurrogateParent
-
getListOfActiveFormattingElements
public StackNode<T>[] getListOfActiveFormattingElements()
Description copied from interface:TreeBuilderState
Returns the listOfActiveFormattingElements.- Specified by:
getListOfActiveFormattingElements
in interfaceTreeBuilderState<T>
- Returns:
- the listOfActiveFormattingElements
- See Also:
TreeBuilderState.getListOfActiveFormattingElements()
-
getStack
public StackNode<T>[] getStack()
Description copied from interface:TreeBuilderState
Returns the stack.- Specified by:
getStack
in interfaceTreeBuilderState<T>
- Returns:
- the stack
- See Also:
TreeBuilderState.getStack()
-
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:
TreeBuilderState.getListOfActiveFormattingElementsLength()
-
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:
TreeBuilderState.getStackLength()
-
errStrayStartTag
private void errStrayStartTag(java.lang.String name) throws org.xml.sax.SAXException
Reports a stray start tag.- Parameters:
name
- the name of the stray tag- Throws:
org.xml.sax.SAXException
-
errStrayEndTag
private void errStrayEndTag(java.lang.String name) throws org.xml.sax.SAXException
Reports a stray end tag.- Parameters:
name
- the name of the stray tag- Throws:
org.xml.sax.SAXException
-
errUnclosedElements
private void errUnclosedElements(int eltPos, java.lang.String name) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
-
errUnclosedElementsImplied
private void errUnclosedElementsImplied(int eltPos, java.lang.String name) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
-
errUnclosedElementsCell
private void errUnclosedElementsCell(int eltPos) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
-
errStrayDoctype
private void errStrayDoctype() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errAlmostStandardsDoctype
private void errAlmostStandardsDoctype() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errQuirkyDoctype
private void errQuirkyDoctype() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNonSpaceInTrailer
private void errNonSpaceInTrailer() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNonSpaceAfterFrameset
private void errNonSpaceAfterFrameset() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNonSpaceInFrameset
private void errNonSpaceInFrameset() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNonSpaceAfterBody
private void errNonSpaceAfterBody() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNonSpaceInColgroupInFragment
private void errNonSpaceInColgroupInFragment() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNonSpaceInNoscriptInHead
private void errNonSpaceInNoscriptInHead() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errFooBetweenHeadAndBody
private void errFooBetweenHeadAndBody(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errStartTagWithoutDoctype
private void errStartTagWithoutDoctype() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNoSelectInTableScope
private void errNoSelectInTableScope() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errStartSelectWhereEndSelectExpected
private void errStartSelectWhereEndSelectExpected() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errStartTagWithSelectOpen
private void errStartTagWithSelectOpen(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errBadStartTagInHead
private void errBadStartTagInHead(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errImage
private void errImage() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errIsindex
private void errIsindex() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errFooSeenWhenFooOpen
private void errFooSeenWhenFooOpen(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errHeadingWhenHeadingOpen
private void errHeadingWhenHeadingOpen() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errFramesetStart
private void errFramesetStart() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNoCellToClose
private void errNoCellToClose() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errStartTagInTable
private void errStartTagInTable(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errFormWhenFormOpen
private void errFormWhenFormOpen() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errTableSeenWhileTableOpen
private void errTableSeenWhileTableOpen() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errStartTagInTableBody
private void errStartTagInTableBody(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEndTagSeenWithoutDoctype
private void errEndTagSeenWithoutDoctype() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEndTagAfterBody
private void errEndTagAfterBody() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEndTagSeenWithSelectOpen
private void errEndTagSeenWithSelectOpen(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errGarbageInColgroup
private void errGarbageInColgroup() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEndTagBr
private void errEndTagBr() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNoElementToCloseButEndTagSeen
private void errNoElementToCloseButEndTagSeen(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errHtmlStartTagInForeignContext
private void errHtmlStartTagInForeignContext(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errTableClosedWhileCaptionOpen
private void errTableClosedWhileCaptionOpen() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNoTableRowToClose
private void errNoTableRowToClose() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNonSpaceInTable
private void errNonSpaceInTable() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errUnclosedChildrenInRuby
private void errUnclosedChildrenInRuby() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errStartTagSeenWithoutRuby
private void errStartTagSeenWithoutRuby(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errSelfClosing
private void errSelfClosing() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errNoCheckUnclosedElementsOnStack
private void errNoCheckUnclosedElementsOnStack() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEndTagDidNotMatchCurrentOpenElement
private void errEndTagDidNotMatchCurrentOpenElement(java.lang.String name, java.lang.String currOpenName) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEndTagViolatesNestingRules
private void errEndTagViolatesNestingRules(java.lang.String name) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEofWithUnclosedElements
private void errEofWithUnclosedElements() throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
errEndWithUnclosedElements
private void errEndWithUnclosedElements(java.lang.String name) throws org.xml.sax.SAXException
Reports arriving at/near end of document with unclosed elements remaining.- Parameters:
message
- the message- Throws:
org.xml.sax.SAXException
-
-