public abstract class TreeBuilder<T> extends java.lang.Object implements TokenHandler, TreeBuilderState<T>
Modifier and Type | Field and 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 |
Modifier | Constructor and Description |
---|---|
protected |
TreeBuilder() |
Modifier and Type | Method and 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(ElementName elementName,
HtmlAttributes attributes) |
private void |
appendVoidElementToCurrentMayFoster(java.lang.String name,
HtmlAttributes attributes,
T form) |
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 or
null . |
void |
setFragmentContext(java.lang.String context,
java.lang.String ns,
T node,
boolean quirks)
The argument MUST be an interned string or
null . |
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, return
true . |
(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 locator
|
void |
zeroOriginatingReplacementCharacter()
Reports a U+0000 that's being turned into a U+FFFD.
|
private static final char[] REPLACEMENT_CHARACTER
static final int OTHER
static final int A
static final int BASE
static final int BODY
static final int BR
static final int BUTTON
static final int CAPTION
static final int COL
static final int COLGROUP
static final int FORM
static final int FRAME
static final int FRAMESET
static final int IMAGE
static final int INPUT
static final int ISINDEX
static final int LI
static final int LINK_OR_BASEFONT_OR_BGSOUND
static final int MATH
static final int META
static final int SVG
static final int HEAD
static final int HR
static final int HTML
static final int NOBR
static final int NOFRAMES
static final int NOSCRIPT
static final int OPTGROUP
static final int OPTION
static final int P
static final int PLAINTEXT
static final int SCRIPT
static final int SELECT
static final int STYLE
static final int TABLE
static final int TEXTAREA
static final int TITLE
static final int TR
static final int XMP
static final int TBODY_OR_THEAD_OR_TFOOT
static final int TD_OR_TH
static final int DD_OR_DT
static final int H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6
static final int MARQUEE_OR_APPLET
static final int PRE_OR_LISTING
static final int B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U
static final int UL_OR_OL_OR_DL
static final int IFRAME
static final int EMBED_OR_IMG
static final int AREA_OR_WBR
static final int DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU
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
static final int RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR
static final int RT_OR_RP
static final int COMMAND
static final int PARAM_OR_SOURCE_OR_TRACK
static final int MGLYPH_OR_MALIGNMARK
static final int MI_MO_MN_MS_MTEXT
static final int ANNOTATION_XML
static final int FOREIGNOBJECT_OR_DESC
static final int NOEMBED
static final int FIELDSET
static final int OUTPUT_OR_LABEL
static final int OBJECT
static final int FONT
static final int KEYGEN
static final int MENUITEM
private static final int INITIAL
private static final int BEFORE_HTML
private static final int BEFORE_HEAD
private static final int IN_HEAD
private static final int IN_HEAD_NOSCRIPT
private static final int AFTER_HEAD
private static final int IN_BODY
private static final int IN_TABLE
private static final int IN_CAPTION
private static final int IN_COLUMN_GROUP
private static final int IN_TABLE_BODY
private static final int IN_ROW
private static final int IN_CELL
private static final int IN_SELECT
private static final int IN_SELECT_IN_TABLE
private static final int AFTER_BODY
private static final int IN_FRAMESET
private static final int AFTER_FRAMESET
private static final int AFTER_AFTER_BODY
private static final int AFTER_AFTER_FRAMESET
private static final int TEXT
private static final int FRAMESET_OK
private static final int CHARSET_INITIAL
private static final int CHARSET_C
private static final int CHARSET_H
private static final int CHARSET_A
private static final int CHARSET_R
private static final int CHARSET_S
private static final int CHARSET_E
private static final int CHARSET_T
private static final int CHARSET_EQUALS
private static final int CHARSET_SINGLE_QUOTED
private static final int CHARSET_DOUBLE_QUOTED
private static final int CHARSET_UNQUOTED
private static final java.lang.String[] HTML4_PUBLIC_IDS
private static final java.lang.String[] QUIRKY_PUBLIC_IDS
private static final int NOT_FOUND_ON_STACK
private static final java.lang.String HTML_LOCAL
private int mode
private int originalMode
private boolean framesetOk
protected Tokenizer tokenizer
protected org.xml.sax.ErrorHandler errorHandler
private DocumentModeHandler documentModeHandler
private DoctypeExpectation doctypeExpectation
private LocatorImpl firstCommentLocation
private boolean scriptingEnabled
private boolean needToDropLF
private boolean wantingComments
private boolean fragment
private java.lang.String contextName
private java.lang.String contextNamespace
private T contextNode
private int currentPtr
private int listPtr
private T formPointer
private T headPointer
private T deepTreeSurrogateParent
protected char[] charBuffer
protected int charBufferLen
private boolean quirks
private boolean reportingDoctype
private XmlViolationPolicy namePolicy
private final java.util.Map<java.lang.String,LocatorImpl> idLocations
private boolean html4
protected void fatal() throws org.xml.sax.SAXException
org.xml.sax.SAXException
org.xml.sax.SAXParseException
protected final void fatal(java.lang.Exception e) throws org.xml.sax.SAXException
org.xml.sax.SAXException
final void fatal(java.lang.String s) throws org.xml.sax.SAXException
org.xml.sax.SAXException
final void err(java.lang.String message) throws org.xml.sax.SAXException
message
- the messageorg.xml.sax.SAXException
final void errNoCheck(java.lang.String message) throws org.xml.sax.SAXException
message
- the messageorg.xml.sax.SAXException
private void errListUnclosedStartTags(int eltPos) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private final void reportUnclosedElementNameAndLocation(int pos) throws org.xml.sax.SAXException
org.xml.sax.SAXException
final void warn(java.lang.String message) throws org.xml.sax.SAXException
message
- the messageorg.xml.sax.SAXException
final void warn(java.lang.String message, org.xml.sax.Locator locator) throws org.xml.sax.SAXException
message
- the messageorg.xml.sax.SAXException
public final void startTokenization(Tokenizer self) throws org.xml.sax.SAXException
TokenHandler
Tokenizer
in order to set the content
model flag and in order to be able to query for Locator
data.startTokenization
in interface TokenHandler
self
- the Tokenizer
.org.xml.sax.SAXException
- if something went wrongpublic final void doctype(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean forceQuirks) throws org.xml.sax.SAXException
TokenHandler
doctype
in interface TokenHandler
name
- the namepublicIdentifier
- the public idsystemIdentifier
- the system idforceQuirks
- whether the token is correctorg.xml.sax.SAXException
- if something went wrongprivate boolean isHtml4Doctype(java.lang.String publicIdentifier)
public final void comment(char[] buf, int start, int length) throws org.xml.sax.SAXException
TokenHandler
wantsComments()
returned false
.comment
in interface TokenHandler
buf
- a buffer holding the datastart
- the offset into the bufferlength
- the number of code units to readorg.xml.sax.SAXException
- if something went wrongpublic final void characters(char[] buf, int start, int length) throws org.xml.sax.SAXException
TokenHandler
characters
in interface TokenHandler
buf
- a buffer holding the datastart
- offset into the bufferlength
- the number of code units to readorg.xml.sax.SAXException
- if something went wrongTokenHandler.characters(char[], int,
int)
public void zeroOriginatingReplacementCharacter() throws org.xml.sax.SAXException
TokenHandler
zeroOriginatingReplacementCharacter
in interface TokenHandler
org.xml.sax.SAXException
- if something went wrongTokenHandler.zeroOriginatingReplacementCharacter()
public final void eof() throws org.xml.sax.SAXException
TokenHandler
eof
in interface TokenHandler
org.xml.sax.SAXException
- if something went wrongpublic final void endTokenization() throws org.xml.sax.SAXException
TokenHandler
endTokenization
in interface TokenHandler
org.xml.sax.SAXException
- if something went wrongTokenHandler.endTokenization()
public final void startTag(ElementName elementName, HtmlAttributes attributes, boolean selfClosing) throws org.xml.sax.SAXException
TokenHandler
startTag
in interface TokenHandler
elementName
- the tag nameattributes
- the attributesselfClosing
- TODOorg.xml.sax.SAXException
- if something went wrongpublic static java.lang.String extractCharsetFromContent(java.lang.String attributeValue)
C++ memory note: The return value must be released.
org.xml.sax.SAXException
StopSniffingException
private void checkMetaCharset(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public final void endTag(ElementName elementName) throws org.xml.sax.SAXException
TokenHandler
endTag
in interface TokenHandler
elementName
- the tag nameorg.xml.sax.SAXException
- if something went wrongprivate int findLastInTableScopeOrRootTbodyTheadTfoot()
private int findLast(java.lang.String name)
private int findLastInTableScope(java.lang.String name)
private int findLastInButtonScope(java.lang.String name)
private int findLastInScope(java.lang.String name)
private int findLastInListScope(java.lang.String name)
private int findLastInScopeHn()
private void generateImpliedEndTagsExceptFor(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void generateImpliedEndTags() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private boolean isSecondOnStackBody()
private void documentModeInternal(DocumentMode m, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private boolean isAlmostStandards(java.lang.String publicIdentifier, java.lang.String systemIdentifier)
private boolean isQuirky(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean forceQuirks)
private void closeTheCell(int eltPos) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private int findLastInTableScopeTdTh()
private void clearStackBackTo(int eltPos) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void resetTheInsertionMode()
private void implicitlyCloseP() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private boolean clearLastStackSlot()
private boolean clearLastListSlot()
private void push(StackNode<T> node) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void silentPush(StackNode<T> node) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void insertMarker()
private void clearTheListOfActiveFormattingElementsUpToTheLastMarker()
private boolean isCurrent(java.lang.String name)
private void removeFromStack(int pos) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void removeFromStack(StackNode<T> node) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void removeFromListOfActiveFormattingElements(int pos)
private boolean adoptionAgencyEndTag(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void insertIntoStack(StackNode<T> node, int position) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void insertIntoListOfActiveFormattingElements(StackNode<T> formattingClone, int bookmark)
private int findInListOfActiveFormattingElements(StackNode<T> node)
private int findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(java.lang.String name)
private void maybeForgetEarlierDuplicateFormattingElement(java.lang.String name, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private int findLastOrRoot(java.lang.String name)
private int findLastOrRoot(int group)
private boolean addAttributesToBody(HtmlAttributes attributes) throws org.xml.sax.SAXException
attributes
- the attributestrue
iff the attributes were addedorg.xml.sax.SAXException
private void addAttributesToHtml(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void pushHeadPointerOntoStack() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void reconstructTheActiveFormattingElements() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void insertIntoFosterParent(T child) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void pop() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void silentPop() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void popOnEof() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void checkAttributes(HtmlAttributes attributes, java.lang.String ns) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private java.lang.String checkPopName(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendHtmlElementToDocumentAndPush(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendHtmlElementToDocumentAndPush() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushHeadElement(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushBodyElement(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushBodyElement() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushFormElementMayFoster(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushFormattingElementMayFoster(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushElement(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushElementMayFosterMathML(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private boolean annotationXmlEncodingPermitsHtml(HtmlAttributes attributes)
private void appendToCurrentNodeAndPushElementMayFosterSVG(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendToCurrentNodeAndPushElementMayFoster(ElementName elementName, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendVoidElementToCurrentMayFoster(java.lang.String name, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendVoidElementToCurrentMayFoster(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendVoidElementToCurrentMayFosterSVG(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendVoidElementToCurrentMayFosterMathML(ElementName elementName, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendVoidElementToCurrent(java.lang.String name, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void appendVoidFormToCurrent(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private final void accumulateCharactersForced(char[] buf, int start, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void accumulateCharacters(char[] buf, int start, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected final void requestSuspension()
protected abstract T createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected T createElement(java.lang.String ns, java.lang.String name, HtmlAttributes attributes, T form) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract T createHtmlElementSetAsRoot(HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void detachFromParent(T element) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract boolean hasChildren(T element) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void appendElement(T child, T newParent) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void appendChildrenToNewParent(T oldParent, T newParent) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void insertFosterParentedChild(T child, T table, T stackParent) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void insertFosterParentedCharacters(char[] buf, int start, int length, T table, T stackParent) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void appendCharacters(T parent, char[] buf, int start, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void appendIsindexPrompt(T parent) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void appendComment(T parent, char[] buf, int start, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void appendCommentToDocument(char[] buf, int start, int length) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected abstract void addAttributesToElement(T element, HtmlAttributes attributes) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void markMalformedIfScript(T elt) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void start(boolean fragmentMode) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void end() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void appendDoctypeToDocument(java.lang.String name, java.lang.String publicIdentifier, java.lang.String systemIdentifier) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void elementPushed(java.lang.String ns, java.lang.String name, T node) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void elementPopped(java.lang.String ns, java.lang.String name, T node) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void documentMode(DocumentMode m, java.lang.String publicIdentifier, java.lang.String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public boolean wantsComments()
TokenHandler
true
. If not, return false
.wantsComments
in interface TokenHandler
TokenHandler.wantsComments()
public void setIgnoringComments(boolean ignoreComments)
public final void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
errorHandler
- the errorHandler to setpublic org.xml.sax.ErrorHandler getErrorHandler()
public final void setFragmentContext(java.lang.String context)
null
.context
- public boolean cdataSectionAllowed() throws org.xml.sax.SAXException
TokenHandler
cdataSectionAllowed
in interface TokenHandler
true
if CDATA sections are allowedorg.xml.sax.SAXException
- if something went wrongTokenHandler.cdataSectionAllowed()
private boolean isInForeign()
private boolean isInForeignButNotHtmlOrMathTextIntegrationPoint()
public final void setFragmentContext(java.lang.String context, java.lang.String ns, T node, boolean quirks)
null
.context
- protected final T currentNode()
public boolean isScriptingEnabled()
public void setScriptingEnabled(boolean scriptingEnabled)
scriptingEnabled
- the scriptingEnabled to setpublic void setDoctypeExpectation(DoctypeExpectation doctypeExpectation)
doctypeExpectation
- the doctypeExpectation to setpublic void setNamePolicy(XmlViolationPolicy namePolicy)
public void setDocumentModeHandler(DocumentModeHandler documentModeHandler)
documentModeHandler
- the documentModeHandler to setpublic void setReportingDoctype(boolean reportingDoctype)
reportingDoctype
- the reportingDoctype to setpublic final void flushCharacters() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private boolean charBufferContainsNonWhitespace()
public TreeBuilderState<T> newSnapshot() throws org.xml.sax.SAXException
delete
on the returned object.org.xml.sax.SAXException
public boolean snapshotMatches(TreeBuilderState<T> snapshot)
public void loadState(TreeBuilderState<T> snapshot, Interner interner) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public T getFormPointer()
TreeBuilderState
getFormPointer
in interface TreeBuilderState<T>
TreeBuilderState.getFormPointer()
public T getHeadPointer()
getHeadPointer
in interface TreeBuilderState<T>
public T getDeepTreeSurrogateParent()
getDeepTreeSurrogateParent
in interface TreeBuilderState<T>
public StackNode<T>[] getListOfActiveFormattingElements()
TreeBuilderState
getListOfActiveFormattingElements
in interface TreeBuilderState<T>
TreeBuilderState.getListOfActiveFormattingElements()
public StackNode<T>[] getStack()
TreeBuilderState
getStack
in interface TreeBuilderState<T>
TreeBuilderState.getStack()
public int getMode()
getMode
in interface TreeBuilderState<T>
public int getOriginalMode()
getOriginalMode
in interface TreeBuilderState<T>
public boolean isFramesetOk()
isFramesetOk
in interface TreeBuilderState<T>
public boolean isNeedToDropLF()
isNeedToDropLF
in interface TreeBuilderState<T>
public boolean isQuirks()
isQuirks
in interface TreeBuilderState<T>
public int getListOfActiveFormattingElementsLength()
TreeBuilderState
getListOfActiveFormattingElementsLength
in interface TreeBuilderState<T>
TreeBuilderState.getListOfActiveFormattingElementsLength()
public int getStackLength()
TreeBuilderState
getStackLength
in interface TreeBuilderState<T>
TreeBuilderState.getStackLength()
private void errStrayStartTag(java.lang.String name) throws org.xml.sax.SAXException
name
- the name of the stray tagorg.xml.sax.SAXException
private void errStrayEndTag(java.lang.String name) throws org.xml.sax.SAXException
name
- the name of the stray tagorg.xml.sax.SAXException
private void errUnclosedElements(int eltPos, java.lang.String name) throws org.xml.sax.SAXException
eltPos
- the position of the start tag on the stack of the element
being closed.name
- the name of the end tagorg.xml.sax.SAXException
private void errUnclosedElementsImplied(int eltPos, java.lang.String name) throws org.xml.sax.SAXException
eltPos
- the position of the start tag on the stack of the element
being closed.name
- the name of the end tagorg.xml.sax.SAXException
private void errUnclosedElementsCell(int eltPos) throws org.xml.sax.SAXException
eltPos
- the position of the start tag on the stack of the element
being closed.org.xml.sax.SAXException
private void errStrayDoctype() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errAlmostStandardsDoctype() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errQuirkyDoctype() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNonSpaceInTrailer() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNonSpaceAfterFrameset() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNonSpaceInFrameset() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNonSpaceAfterBody() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNonSpaceInColgroupInFragment() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNonSpaceInNoscriptInHead() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errFooBetweenHeadAndBody(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errStartTagWithoutDoctype() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNoSelectInTableScope() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errStartSelectWhereEndSelectExpected() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errStartTagWithSelectOpen(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errBadStartTagInHead(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errImage() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errIsindex() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errFooSeenWhenFooOpen(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errHeadingWhenHeadingOpen() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errFramesetStart() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNoCellToClose() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errStartTagInTable(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errFormWhenFormOpen() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errTableSeenWhileTableOpen() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errStartTagInTableBody(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEndTagSeenWithoutDoctype() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEndTagAfterBody() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEndTagSeenWithSelectOpen(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errGarbageInColgroup() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEndTagBr() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNoElementToCloseButEndTagSeen(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errHtmlStartTagInForeignContext(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errTableClosedWhileCaptionOpen() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNoTableRowToClose() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNonSpaceInTable() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errUnclosedChildrenInRuby() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errStartTagSeenWithoutRuby(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errSelfClosing() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errNoCheckUnclosedElementsOnStack() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEndTagDidNotMatchCurrentOpenElement(java.lang.String name, java.lang.String currOpenName) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEndTagViolatesNestingRules(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEofWithUnclosedElements() throws org.xml.sax.SAXException
org.xml.sax.SAXException
private void errEndWithUnclosedElements(java.lang.String name) throws org.xml.sax.SAXException
message
- the messageorg.xml.sax.SAXException