|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nu.validator.htmlparser.impl.TreeBuilder<T>
public abstract class TreeBuilder<T>
Field Summary | |
---|---|
protected char[] |
charBuffer
|
protected int |
charBufferLen
|
protected org.xml.sax.ErrorHandler |
errorHandler
|
protected Tokenizer |
tokenizer
|
Constructor Summary | |
---|---|
protected |
TreeBuilder()
|
Method Summary | |
---|---|
protected void |
accumulateCharacters(char[] buf,
int start,
int length)
|
protected abstract void |
addAttributesToElement(T element,
HtmlAttributes attributes)
|
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)
|
protected abstract void |
appendIsindexPrompt(T parent)
|
boolean |
cdataSectionAllowed()
Checks if the CDATA sections are allowed. |
void |
characters(char[] buf,
int start,
int length)
Receive character tokens. |
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)
|
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. |
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)
|
void |
flushCharacters()
Flushes the pending characters. |
T |
getDeepTreeSurrogateParent()
Returns the deepTreeSurrogateParent. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Returns the errorHandler. |
T |
getFormPointer()
Returns the formPointer. |
T |
getHeadPointer()
Returns the headPointer. |
nu.validator.htmlparser.impl.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. |
nu.validator.htmlparser.impl.StackNode<T>[] |
getStack()
Returns the stack. |
int |
getStackLength()
Return the length of the stack. |
protected abstract boolean |
hasChildren(T element)
|
protected abstract void |
insertFosterParentedCharacters(char[] buf,
int start,
int length,
T table,
T stackParent)
|
protected abstract void |
insertFosterParentedChild(T child,
T table,
T stackParent)
|
boolean |
isFramesetOk()
Returns the framesetOk. |
boolean |
isNeedToDropLF()
Returns the needToDropLF. |
boolean |
isQuirks()
Returns the quirks. |
boolean |
isScriptingEnabled()
Returns the scriptingEnabled. |
void |
loadState(TreeBuilderState<T> snapshot,
Interner interner)
|
protected void |
markMalformedIfScript(T elt)
|
TreeBuilderState<T> |
newSnapshot()
Creates a comparable snapshot of the tree builder state. |
protected void |
requestSuspension()
|
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. |
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 . |
void |
zeroOriginatingReplacementCharacter()
Reports a U+0000 that's being turned into a U+FFFD. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Tokenizer tokenizer
protected org.xml.sax.ErrorHandler errorHandler
protected char[] charBuffer
protected int charBufferLen
Constructor Detail |
---|
protected TreeBuilder()
Method Detail |
---|
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
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 correct
org.xml.sax.SAXException
- if something went wrongpublic 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 read
org.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 read
org.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
- TODO
org.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
public final void endTag(ElementName elementName) throws org.xml.sax.SAXException
TokenHandler
endTag
in interface TokenHandler
elementName
- the tag name
org.xml.sax.SAXException
- if something went wrongprotected 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 allowed
org.xml.sax.SAXException
- if something went wrongTokenHandler.cdataSectionAllowed()
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
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 nu.validator.htmlparser.impl.StackNode<T>[] getListOfActiveFormattingElements()
TreeBuilderState
getListOfActiveFormattingElements
in interface TreeBuilderState<T>
TreeBuilderState.getListOfActiveFormattingElements()
public nu.validator.htmlparser.impl.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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |