|
||||||||||
| 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>
| Field Summary | |
|---|---|
protected char[] |
charBuffer
|
protected int |
charBufferLen
|
protected 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(String name,
String publicIdentifier,
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(String ns,
String name,
HtmlAttributes attributes)
|
protected T |
createElement(String ns,
String name,
HtmlAttributes attributes,
T form)
|
protected abstract T |
createHtmlElementSetAsRoot(HtmlAttributes attributes)
|
protected T |
currentNode()
|
protected abstract void |
detachFromParent(T element)
|
void |
doctype(String name,
String publicIdentifier,
String systemIdentifier,
boolean forceQuirks)
Receive a doctype token. |
protected void |
documentMode(DocumentMode m,
String publicIdentifier,
String systemIdentifier,
boolean html4SpecificAdditionalErrorChecks)
|
protected void |
elementPopped(String ns,
String name,
T node)
|
protected void |
elementPushed(String ns,
String name,
T node)
|
protected void |
end()
|
void |
endTag(ElementName elementName)
Receive an end tag token. |
void |
endTokenization()
The perform final cleanup. |
void |
eof()
The end-of-file token. |
static String |
extractCharsetFromContent(String attributeValue)
C++ memory note: The return value must be released. |
protected void |
fatal()
Reports an condition that would make the infoset incompatible with XML 1.0 as fatal. |
protected void |
fatal(Exception e)
|
void |
flushCharacters()
Flushes the pending characters. |
T |
getDeepTreeSurrogateParent()
Returns the deepTreeSurrogateParent. |
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(ErrorHandler errorHandler)
Sets the errorHandler. |
void |
setFragmentContext(String context)
The argument MUST be an interned string or null. |
void |
setFragmentContext(String context,
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 ErrorHandler errorHandler
protected char[] charBuffer
protected int charBufferLen
| Constructor Detail |
|---|
protected TreeBuilder()
| Method Detail |
|---|
protected void fatal()
throws SAXException
SAXException
SAXParseException
protected final void fatal(Exception e)
throws SAXException
SAXException
public final void startTokenization(Tokenizer self)
throws SAXException
TokenHandlerTokenizer in order to set the content
model flag and in order to be able to query for Locator
data.
startTokenization in interface TokenHandlerself - the Tokenizer.
SAXException - if something went wrong
public final void doctype(String name,
String publicIdentifier,
String systemIdentifier,
boolean forceQuirks)
throws SAXException
TokenHandler
doctype in interface TokenHandlername - the namepublicIdentifier - the public idsystemIdentifier - the system idforceQuirks - whether the token is correct
SAXException - if something went wrong
public final void comment(char[] buf,
int start,
int length)
throws SAXException
TokenHandlerwantsComments() returned false.
comment in interface TokenHandlerbuf - a buffer holding the datastart - the offset into the bufferlength - the number of code units to read
SAXException - if something went wrong
public final void characters(char[] buf,
int start,
int length)
throws SAXException
TokenHandler
characters in interface TokenHandlerbuf - 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 void zeroOriginatingReplacementCharacter()
throws SAXException
TokenHandler
zeroOriginatingReplacementCharacter in interface TokenHandlerSAXException - if something went wrongTokenHandler.zeroOriginatingReplacementCharacter()
public final void eof()
throws SAXException
TokenHandler
eof in interface TokenHandlerSAXException - if something went wrong
public final void endTokenization()
throws SAXException
TokenHandler
endTokenization in interface TokenHandlerSAXException - if something went wrongTokenHandler.endTokenization()
public final void startTag(ElementName elementName,
HtmlAttributes attributes,
boolean selfClosing)
throws SAXException
TokenHandler
startTag in interface TokenHandlerelementName - the tag nameattributes - the attributesselfClosing - TODO
SAXException - if something went wrongpublic static String extractCharsetFromContent(String attributeValue)
C++ memory note: The return value must be released.
SAXException
StopSniffingException
public final void endTag(ElementName elementName)
throws SAXException
TokenHandler
endTag in interface TokenHandlerelementName - the tag name
SAXException - if something went wrong
protected void accumulateCharacters(char[] buf,
int start,
int length)
throws SAXException
SAXExceptionprotected final void requestSuspension()
protected abstract T createElement(String ns,
String name,
HtmlAttributes attributes)
throws SAXException
SAXException
protected T createElement(String ns,
String name,
HtmlAttributes attributes,
T form)
throws SAXException
SAXException
protected abstract T createHtmlElementSetAsRoot(HtmlAttributes attributes)
throws SAXException
SAXException
protected abstract void detachFromParent(T element)
throws SAXException
SAXException
protected abstract boolean hasChildren(T element)
throws SAXException
SAXException
protected abstract void appendElement(T child,
T newParent)
throws SAXException
SAXException
protected abstract void appendChildrenToNewParent(T oldParent,
T newParent)
throws SAXException
SAXException
protected abstract void insertFosterParentedChild(T child,
T table,
T stackParent)
throws SAXException
SAXException
protected abstract void insertFosterParentedCharacters(char[] buf,
int start,
int length,
T table,
T stackParent)
throws SAXException
SAXException
protected abstract void appendCharacters(T parent,
char[] buf,
int start,
int length)
throws SAXException
SAXException
protected abstract void appendIsindexPrompt(T parent)
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,
HtmlAttributes attributes)
throws SAXException
SAXException
protected void markMalformedIfScript(T elt)
throws SAXException
SAXException
protected void start(boolean fragmentMode)
throws SAXException
SAXException
protected void end()
throws SAXException
SAXException
protected void appendDoctypeToDocument(String name,
String publicIdentifier,
String systemIdentifier)
throws SAXException
SAXException
protected void elementPushed(String ns,
String name,
T node)
throws SAXException
SAXException
protected void elementPopped(String ns,
String name,
T node)
throws SAXException
SAXException
protected void documentMode(DocumentMode m,
String publicIdentifier,
String systemIdentifier,
boolean html4SpecificAdditionalErrorChecks)
throws SAXException
SAXExceptionpublic boolean wantsComments()
TokenHandlertrue. If not, return false.
wantsComments in interface TokenHandlerTokenHandler.wantsComments()public void setIgnoringComments(boolean ignoreComments)
public final void setErrorHandler(ErrorHandler errorHandler)
errorHandler - the errorHandler to setpublic ErrorHandler getErrorHandler()
public final void setFragmentContext(String context)
null.
context -
public boolean cdataSectionAllowed()
throws SAXException
TokenHandler
cdataSectionAllowed in interface TokenHandlertrue if CDATA sections are allowed
SAXException - if something went wrongTokenHandler.cdataSectionAllowed()
public final void setFragmentContext(String context,
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 set
public final void flushCharacters()
throws SAXException
SAXException
public TreeBuilderState<T> newSnapshot()
throws SAXException
delete on the returned object.
SAXExceptionpublic boolean snapshotMatches(TreeBuilderState<T> snapshot)
public void loadState(TreeBuilderState<T> snapshot,
Interner interner)
throws SAXException
SAXExceptionpublic 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 | |||||||||