|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnu.validator.htmlparser.impl.TreeBuilder<T>
public abstract class TreeBuilder<T>
Nested Class Summary | |
---|---|
private static class |
TreeBuilder.Phase
|
private class |
TreeBuilder.StackNode<S>
|
Constructor Summary | |
---|---|
protected |
TreeBuilder(XmlViolationPolicy streamabilityViolationPolicy,
boolean coalescingText)
|
Method Summary | |
---|---|
private void |
accumulateCharacters(char[] buf,
int start,
int length)
|
private void |
addAttributesToBody(Attributes attributes)
|
protected abstract void |
addAttributesToElement(T element,
Attributes attributes)
|
private void |
adoptionAgencyEndTag(String name)
|
private void |
append(TreeBuilder.StackNode<T> node)
|
protected abstract void |
appendCharacters(T parent,
char[] buf,
int start,
int length)
|
private void |
appendCharMayFoster(char[] buf,
int i)
|
protected abstract void |
appendChildrenToNewParent(T oldParent,
T newParent)
|
protected abstract void |
appendComment(T parent,
char[] buf,
int start,
int length)
|
protected abstract void |
appendCommentToDocument(char[] buf,
int start,
int length)
|
protected void |
appendDoctypeToDocument(String name,
String publicIdentifier,
String systemIdentifier)
|
private void |
appendHtmlElementToDocumentAndPush()
|
private void |
appendHtmlElementToDocumentAndPush(Attributes attributes)
|
private void |
appendToCurrentNodeAndPushBodyElement()
|
private void |
appendToCurrentNodeAndPushBodyElement(Attributes attributes)
|
private void |
appendToCurrentNodeAndPushElement(String name,
Attributes attributes)
|
private void |
appendToCurrentNodeAndPushElementMayFoster(String name,
Attributes attributes)
|
private void |
appendToCurrentNodeAndPushElementMayFoster(String name,
Attributes attributes,
T form)
|
private void |
appendToCurrentNodeAndPushFormattingElementMayFoster(String name,
Attributes attributes)
|
private void |
appendToCurrentNodeAndPushFormElementMayFoster(Attributes attributes)
|
private void |
appendToCurrentNodeAndPushHeadElement(Attributes attributes)
|
private void |
appendVoidElementToCurrentMayFoster(String name,
Attributes attributes)
|
private void |
appendVoidElementToCurrentMayFoster(String name,
Attributes attributes,
T form)
|
protected void |
bodyClosed(T body)
|
void |
characters(char[] buf,
int start,
int length)
Receive character tokens. |
private boolean |
clearLastListSlot()
|
private boolean |
clearLastStackSlot()
|
private void |
clearStackBackTo(int eltPos)
|
private void |
clearTheListOfActiveFormattingElementsUpToTheLastMarker()
|
private void |
closeTheCell(int eltPos)
|
void |
comment(char[] buf,
int length)
Receive a comment token. |
protected abstract T |
createElement(String name,
Attributes attributes)
|
protected T |
createElement(String name,
Attributes attributes,
T form)
|
protected abstract T |
createHtmlElementSetAsRoot(Attributes attributes)
|
protected T |
currentNode()
|
protected abstract void |
detachFromParent(T element)
|
protected abstract void |
detachFromParentAndAppendToNewParent(T child,
T newParent)
|
void |
doctype(String name,
String publicIdentifier,
String systemIdentifier,
boolean correct)
Receive a doctype token. |
protected void |
documentMode(DocumentMode mode,
String publicIdentifier,
String systemIdentifier,
boolean html4SpecificAdditionalErrorChecks)
|
private void |
documentModeInternal(DocumentMode mode,
String publicIdentifier,
String systemIdentifier,
boolean html4SpecificAdditionalErrorChecks)
|
protected void |
elementPopped(String name,
T node)
|
protected void |
elementPushed(String name,
T node)
|
protected void |
end()
|
void |
endTag(String name,
Attributes attributes)
Receive an end tag token. |
void |
eof()
The end-of-file token. |
protected void |
err(String message)
Reports a Parse Error. |
protected void |
fatal()
Reports an condition that would make the infoset incompatible with XML 1.0 as fatal. |
protected void |
fatal(Exception e)
|
private int |
findDdOrDtToPop()
|
private int |
findInListOfActiveFormattingElements(TreeBuilder.StackNode<T> node)
|
private int |
findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(String name)
|
private int |
findLast(String name)
|
private int |
findLastInScope(String name)
|
private int |
findLastInScopeHn()
|
private int |
findLastInTableScope(String name)
|
private int |
findLastInTableScopeOrRootTbodyTheadTfoot()
|
private int |
findLastInTableScopeTdTh()
|
private int |
findLastOrRoot(String name)
|
private int |
findLiToPop()
|
private void |
flushCharacters()
|
private void |
generateImpliedEndTags()
|
private void |
generateImpliedEndTagsExceptFor(String name)
|
protected abstract boolean |
hasChildren(T element)
|
protected void |
htmlClosed(T html)
|
private void |
implicitlyCloseP()
|
protected abstract void |
insertBefore(T child,
T sibling,
T parent)
|
protected abstract void |
insertCharactersBefore(char[] buf,
int start,
int length,
T sibling,
T parent)
|
private void |
insertIntoFosterParent(T child)
|
private void |
insertIntoListOfActiveFormattingElements(TreeBuilder.StackNode<T> formattingClone,
int bookmark)
|
private void |
insertIntoStack(TreeBuilder.StackNode<T> node,
int position)
|
private void |
insertMarker()
|
private boolean |
isAlmostStandards(String publicIdentifierLC,
String systemIdentifierLC)
|
private boolean |
isCurrent(String name)
|
private boolean |
isHtml4Doctype(String publicIdentifier)
|
private boolean |
isInStack(TreeBuilder.StackNode<T> node)
|
private boolean |
isQuirky(String name,
String publicIdentifierLC,
String systemIdentifierLC,
boolean correct)
|
boolean |
isScriptingEnabled()
Returns the scriptingEnabled. |
private boolean |
isSecondOnStackBody()
|
protected abstract T |
parentElementFor(T child)
Get the parent element. |
private void |
pop()
|
private void |
push(TreeBuilder.StackNode<T> node)
|
private void |
pushHeadPointerOntoStack()
|
private void |
reconstructTheActiveFormattingElements()
|
private void |
removeFromListOfActiveFormattingElements(int pos)
|
private void |
removeFromStack(int pos)
|
private void |
removeFromStack(TreeBuilder.StackNode<T> node)
|
private void |
resetTheInsertionMode()
|
void |
setDoctypeExpectation(DoctypeExpectation doctypeExpectation)
Sets the doctypeExpectation. |
void |
setDocumentModeHandler(DocumentModeHandler documentModeHandler)
Sets the documentModeHandler. |
void |
setErrorHandler(ErrorHandler errorHandler)
Sets the errorHandler. |
void |
setFragmentContext(String context)
|
void |
setIgnoringComments(boolean ignoreComments)
|
void |
setReportingDoctype(boolean reportingDoctype)
Sets the reportingDoctype. |
void |
setScriptingEnabled(boolean scriptingEnabled)
Sets the scriptingEnabled. |
protected abstract T |
shallowClone(T element)
|
protected void |
start(boolean fragment)
|
void |
start(Tokenizer self)
This method is called at the start of tokenization before any other methods on this interface are called. |
void |
startTag(String name,
Attributes attributes)
Receive a start tag token. |
private String |
toAsciiLowerCase(String str)
|
boolean |
wantsComments()
If this handler implementation cares about comments, return true . |
protected void |
warn(String message)
Reports a warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final char[] ISINDEX_PROMPT
private static final String[] HTML4_PUBLIC_IDS
private static final String[] QUIRKY_PUBLIC_IDS
private static final int NOT_FOUND_ON_STACK
private final TreeBuilder.StackNode<T> MARKER
private final boolean nonConformingAndStreaming
private final boolean conformingAndStreaming
private final boolean coalescingText
private TreeBuilder.Phase phase
protected Tokenizer tokenizer
private ErrorHandler errorHandler
private DocumentModeHandler documentModeHandler
private DoctypeExpectation doctypeExpectation
private int cdataOrRcdataTimesToPop
private boolean scriptingEnabled
private boolean needToDropLF
private boolean wantingComments
private String context
private TreeBuilder.Phase previousPhaseBeforeTrailingEnd
private TreeBuilder.StackNode<T>[] stack
private int currentPtr
private TreeBuilder.StackNode<T>[] listOfActiveFormattingElements
private int listPtr
private T formPointer
private T headPointer
private boolean reportingDoctype
private char[] charBuffer
private int charBufferLen
Constructor Detail |
---|
protected TreeBuilder(XmlViolationPolicy streamabilityViolationPolicy, boolean coalescingText)
Method Detail |
---|
protected final void fatal() throws SAXException
SAXException
SAXParseException
protected final void fatal(Exception e) throws SAXException
SAXException
protected final void err(String message) throws SAXException
message
- the message
SAXException
protected final void warn(String message) throws SAXException
message
- the message
SAXException
public final void start(Tokenizer self) throws SAXException
TokenHandler
Tokenizer
in order to set the
content model flag and in order to be able to query for
Locator
data.
start
in interface TokenHandler
self
- the Tokenizer
.
SAXException
- if something went wrongpublic final void doctype(String name, String publicIdentifier, String systemIdentifier, boolean correct) throws SAXException
TokenHandler
doctype
in interface TokenHandler
name
- the namepublicIdentifier
- the public idsystemIdentifier
- the system idcorrect
- whether the token is correct
SAXException
- if something went wrongprivate boolean isHtml4Doctype(String publicIdentifier)
public final void comment(char[] buf, int length) throws SAXException
TokenHandler
wantsComments()
returned false
.
comment
in interface TokenHandler
buf
- a buffer holding the datalength
- the number of code units to read
SAXException
- if something went wrongpublic final void characters(char[] buf, int start, int length) throws SAXException
TokenHandler
characters
in interface TokenHandler
buf
- a buffer holding the datastart
- offset into the bufferlength
- the number of code units to read
SAXException
- if something went wrongTokenHandler.characters(char[], int, int)
public final void eof() throws SAXException
TokenHandler
eof
in interface TokenHandler
SAXException
- if something went wrongpublic final void startTag(String name, Attributes attributes) throws SAXException
TokenHandler
startTag
in interface TokenHandler
name
- the tag nameattributes
- the attributes
SAXException
- if something went wrongpublic final void endTag(String name, Attributes attributes) throws SAXException
TokenHandler
endTag
in interface TokenHandler
name
- the tag nameattributes
- the attributes
SAXException
- if something went wrongprivate int findLastInTableScopeOrRootTbodyTheadTfoot()
private int findLast(String name)
private int findLastInTableScope(String name)
private int findLastInScope(String name)
private int findLastInScopeHn()
private void generateImpliedEndTagsExceptFor(String name) throws SAXException
SAXException
private void generateImpliedEndTags() throws SAXException
SAXException
private boolean isSecondOnStackBody()
private void documentModeInternal(DocumentMode mode, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws SAXException
SAXException
private boolean isAlmostStandards(String publicIdentifierLC, String systemIdentifierLC)
private boolean isQuirky(String name, String publicIdentifierLC, String systemIdentifierLC, boolean correct)
private String toAsciiLowerCase(String str)
private void closeTheCell(int eltPos) throws SAXException
SAXException
private int findLastInTableScopeTdTh()
private void clearStackBackTo(int eltPos) throws SAXException
SAXException
private void resetTheInsertionMode()
private void implicitlyCloseP() throws SAXException
SAXException
private boolean clearLastStackSlot()
private boolean clearLastListSlot()
private void push(TreeBuilder.StackNode<T> node) throws SAXException
SAXException
private void append(TreeBuilder.StackNode<T> node)
private void insertMarker()
private void clearTheListOfActiveFormattingElementsUpToTheLastMarker()
private boolean isCurrent(String name)
private void removeFromStack(int pos) throws SAXException
SAXException
private void removeFromStack(TreeBuilder.StackNode<T> node) throws SAXException
SAXException
private void removeFromListOfActiveFormattingElements(int pos)
private void adoptionAgencyEndTag(String name) throws SAXException
SAXException
private void insertIntoStack(TreeBuilder.StackNode<T> node, int position) throws SAXException
SAXException
private void insertIntoListOfActiveFormattingElements(TreeBuilder.StackNode<T> formattingClone, int bookmark)
private int findInListOfActiveFormattingElements(TreeBuilder.StackNode<T> node)
private int findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(String name)
private int findDdOrDtToPop()
private int findLiToPop()
private int findLastOrRoot(String name)
private void addAttributesToBody(Attributes attributes) throws SAXException
SAXException
private void pushHeadPointerOntoStack() throws SAXException
SAXException
private void reconstructTheActiveFormattingElements() throws SAXException
SAXException
private void insertIntoFosterParent(T child) throws SAXException
SAXException
private boolean isInStack(TreeBuilder.StackNode<T> node)
private void pop() throws SAXException
SAXException
private void appendCharMayFoster(char[] buf, int i) throws SAXException
SAXException
private void appendHtmlElementToDocumentAndPush(Attributes attributes) throws SAXException
SAXException
private void appendHtmlElementToDocumentAndPush() throws SAXException
SAXException
private void appendToCurrentNodeAndPushHeadElement(Attributes attributes) throws SAXException
SAXException
private void appendToCurrentNodeAndPushBodyElement(Attributes attributes) throws SAXException
SAXException
private void appendToCurrentNodeAndPushBodyElement() throws SAXException
SAXException
private void appendToCurrentNodeAndPushFormElementMayFoster(Attributes attributes) throws SAXException
SAXException
private void appendToCurrentNodeAndPushFormattingElementMayFoster(String name, Attributes attributes) throws SAXException
SAXException
private void appendToCurrentNodeAndPushElement(String name, Attributes attributes) throws SAXException
SAXException
private void appendToCurrentNodeAndPushElementMayFoster(String name, Attributes attributes) throws SAXException
SAXException
private void appendToCurrentNodeAndPushElementMayFoster(String name, Attributes attributes, T form) throws SAXException
SAXException
private void appendVoidElementToCurrentMayFoster(String name, Attributes attributes, T form) throws SAXException
SAXException
private void appendVoidElementToCurrentMayFoster(String name, Attributes attributes) throws SAXException
SAXException
private void accumulateCharacters(char[] buf, int start, int length) throws SAXException
SAXException
private void flushCharacters() throws SAXException
SAXException
protected abstract T createElement(String name, Attributes attributes) throws SAXException
SAXException
protected T createElement(String name, Attributes attributes, T form) throws SAXException
SAXException
protected abstract T createHtmlElementSetAsRoot(Attributes attributes) throws SAXException
SAXException
protected abstract void detachFromParent(T element) throws SAXException
SAXException
protected abstract boolean hasChildren(T element) throws SAXException
SAXException
protected abstract T shallowClone(T element) throws SAXException
SAXException
protected abstract void detachFromParentAndAppendToNewParent(T child, T newParent) throws SAXException
SAXException
protected abstract void appendChildrenToNewParent(T oldParent, T newParent) throws SAXException
SAXException
protected abstract T parentElementFor(T child) throws SAXException
null
if there is no parent
or the parent is not an element.
SAXException
protected abstract void insertBefore(T child, T sibling, T parent) throws SAXException
SAXException
protected abstract void insertCharactersBefore(char[] buf, int start, int length, T sibling, T parent) throws SAXException
SAXException
protected abstract void appendCharacters(T parent, char[] buf, int start, int length) throws SAXException
SAXException
protected abstract void appendComment(T parent, char[] buf, int start, int length) throws SAXException
SAXException
protected abstract void appendCommentToDocument(char[] buf, int start, int length) throws SAXException
SAXException
protected abstract void addAttributesToElement(T element, Attributes attributes) throws SAXException
SAXException
protected void start(boolean fragment) throws SAXException
SAXException
protected void end() throws SAXException
SAXException
protected void bodyClosed(T body) throws SAXException
SAXException
protected void htmlClosed(T html) throws SAXException
SAXException
protected void appendDoctypeToDocument(String name, String publicIdentifier, String systemIdentifier) throws SAXException
SAXException
protected void elementPushed(String name, T node) throws SAXException
SAXException
protected void elementPopped(String name, T node) throws SAXException
SAXException
protected void documentMode(DocumentMode mode, String publicIdentifier, String systemIdentifier, boolean html4SpecificAdditionalErrorChecks) throws SAXException
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(ErrorHandler errorHandler)
errorHandler
- the errorHandler to setpublic final void setFragmentContext(String 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 setDocumentModeHandler(DocumentModeHandler documentModeHandler)
documentModeHandler
- the documentModeHandler to setpublic void setReportingDoctype(boolean reportingDoctype)
reportingDoctype
- the reportingDoctype to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |