|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.cyberneko.html.HTMLTagBalancer
Balances tags in an HTML document. This component receives document events and tries to correct many common mistakes that human (and computer) HTML document authors make. This tag balancer can:
This component recognizes the following features:
This component recognizes the following properties:
HTMLElements| Nested Class Summary | |
static class |
HTMLTagBalancer.Info
Element info for each start element. |
static class |
HTMLTagBalancer.InfoStack
Unsynchronized stack of element information. |
| Field Summary | |
protected static java.lang.String |
AUGMENTATIONS
Include infoset augmentations. |
protected static java.lang.String |
DOCUMENT_FRAGMENT
Document fragment balancing only. |
protected static java.lang.String |
DOCUMENT_FRAGMENT_DEPRECATED
Document fragment balancing only (deprecated). |
protected static java.lang.String |
ERROR_REPORTER
Error reporter. |
protected boolean |
fAugmentations
Include infoset augmentations. |
protected boolean |
fDocumentFragment
Document fragment balancing only. |
protected org.apache.xerces.xni.XMLDocumentHandler |
fDocumentHandler
The document handler. |
protected org.apache.xerces.xni.parser.XMLDocumentSource |
fDocumentSource
The document source. |
protected HTMLTagBalancer.InfoStack |
fElementStack
The element stack. |
protected HTMLErrorReporter |
fErrorReporter
Error reporter. |
protected boolean |
fIgnoreOutsideContent
Ignore outside content. |
protected HTMLTagBalancer.InfoStack |
fInlineStack
The inline stack. |
protected short |
fNamesAttrs
Modify HTML attribute names. |
protected short |
fNamesElems
Modify HTML element names. |
protected boolean |
fNamespaces
Namespaces. |
protected boolean |
fReportErrors
Report errors. |
protected boolean |
fSeenAnything
True if seen anything. |
protected boolean |
fSeenBodyElement
True if seen <body< element. |
protected boolean |
fSeenDoctype
True if root element has been seen. |
protected boolean |
fSeenHeadElement
True if seen <head< element. |
protected boolean |
fSeenRootElement
True if root element has been seen. |
protected boolean |
fSeenRootElementEnd
True if seen the end of the document element. |
protected static java.lang.String |
IGNORE_OUTSIDE_CONTENT
Ignore outside content. |
protected static java.lang.String |
NAMES_ATTRS
Modify HTML attribute names: { "upper", "lower", "default" }. |
protected static java.lang.String |
NAMES_ELEMS
Modify HTML element names: { "upper", "lower", "default" }. |
protected static short |
NAMES_LOWERCASE
Lowercase HTML names. |
protected static short |
NAMES_MATCH
Match HTML element names. |
protected static short |
NAMES_NO_CHANGE
Don't modify HTML names. |
protected static short |
NAMES_UPPERCASE
Uppercase HTML names. |
protected static java.lang.String |
NAMESPACES
Namespaces. |
protected static java.lang.String |
REPORT_ERRORS
Report errors. |
protected static HTMLEventInfo |
SYNTHESIZED_ITEM
Synthesized event info item. |
| Constructor Summary | |
HTMLTagBalancer()
|
|
| Method Summary | |
protected void |
callEndElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
Call document handler end element. |
protected void |
callStartElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
Call document handler start element. |
void |
characters(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
Characters. |
void |
comment(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
Comment. |
void |
doctypeDecl(java.lang.String rootElementName,
java.lang.String publicId,
java.lang.String systemId,
org.apache.xerces.xni.Augmentations augs)
Doctype declaration. |
protected org.apache.xerces.xni.XMLAttributes |
emptyAttributes()
Returns a set of empty attributes. |
void |
emptyElement(org.apache.xerces.xni.QName elem,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
Empty element. |
void |
endCDATA(org.apache.xerces.xni.Augmentations augs)
End CDATA section. |
void |
endDocument(org.apache.xerces.xni.Augmentations augs)
End document. |
void |
endElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
End element. |
void |
endGeneralEntity(java.lang.String name,
org.apache.xerces.xni.Augmentations augs)
End entity. |
void |
endPrefixMapping(java.lang.String prefix,
org.apache.xerces.xni.Augmentations augs)
End prefix mapping. |
org.apache.xerces.xni.XMLDocumentHandler |
getDocumentHandler()
Returns the document handler. |
org.apache.xerces.xni.parser.XMLDocumentSource |
getDocumentSource()
Returns the document source. |
protected HTMLElements.Element |
getElement(java.lang.String name)
Returns an HTML element. |
protected int |
getElementDepth(HTMLElements.Element element)
Returns the depth of the open tag associated with the specified element name or -1 if no matching element is found. |
java.lang.Boolean |
getFeatureDefault(java.lang.String featureId)
Returns the default state for a feature. |
protected static short |
getNamesValue(java.lang.String value)
Converts HTML names string value to constant value. |
protected int |
getParentDepth(HTMLElements.Element[] parents,
short bounds)
Returns the depth of the open tag associated with the specified element parent names or -1 if no matching element is found. |
java.lang.Object |
getPropertyDefault(java.lang.String propertyId)
Returns the default state for a property. |
java.lang.String[] |
getRecognizedFeatures()
Returns recognized features. |
java.lang.String[] |
getRecognizedProperties()
Returns recognized properties. |
void |
ignorableWhitespace(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
Ignorable whitespace. |
protected static java.lang.String |
modifyName(java.lang.String name,
short mode)
Modifies the given name based on the specified mode. |
void |
processingInstruction(java.lang.String target,
org.apache.xerces.xni.XMLString data,
org.apache.xerces.xni.Augmentations augs)
Processing instruction. |
void |
reset(org.apache.xerces.xni.parser.XMLComponentManager manager)
Resets the component. |
void |
setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)
Sets the document handler. |
void |
setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
Sets the document source. |
void |
setFeature(java.lang.String featureId,
boolean state)
Sets a feature. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object value)
Sets a property. |
void |
startCDATA(org.apache.xerces.xni.Augmentations augs)
Start CDATA section. |
void |
startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
Start document. |
void |
startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.NamespaceContext nscontext,
org.apache.xerces.xni.Augmentations augs)
Start document. |
void |
startElement(org.apache.xerces.xni.QName elem,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
Start element. |
void |
startGeneralEntity(java.lang.String name,
org.apache.xerces.xni.XMLResourceIdentifier id,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
Start entity. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri,
org.apache.xerces.xni.Augmentations augs)
Start prefix mapping. |
protected org.apache.xerces.xni.Augmentations |
synthesizedAugs()
Returns an augmentations object with a synthesized item added. |
void |
textDecl(java.lang.String version,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
Text declaration. |
void |
xmlDecl(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone,
org.apache.xerces.xni.Augmentations augs)
XML declaration. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final java.lang.String NAMESPACES
protected static final java.lang.String AUGMENTATIONS
protected static final java.lang.String REPORT_ERRORS
protected static final java.lang.String DOCUMENT_FRAGMENT_DEPRECATED
protected static final java.lang.String DOCUMENT_FRAGMENT
protected static final java.lang.String IGNORE_OUTSIDE_CONTENT
protected static final java.lang.String NAMES_ELEMS
protected static final java.lang.String NAMES_ATTRS
protected static final java.lang.String ERROR_REPORTER
protected static final short NAMES_NO_CHANGE
protected static final short NAMES_MATCH
protected static final short NAMES_UPPERCASE
protected static final short NAMES_LOWERCASE
protected static final HTMLEventInfo SYNTHESIZED_ITEM
protected boolean fNamespaces
protected boolean fAugmentations
protected boolean fReportErrors
protected boolean fDocumentFragment
protected boolean fIgnoreOutsideContent
protected short fNamesElems
protected short fNamesAttrs
protected HTMLErrorReporter fErrorReporter
protected org.apache.xerces.xni.parser.XMLDocumentSource fDocumentSource
protected org.apache.xerces.xni.XMLDocumentHandler fDocumentHandler
protected final HTMLTagBalancer.InfoStack fElementStack
protected final HTMLTagBalancer.InfoStack fInlineStack
protected boolean fSeenAnything
protected boolean fSeenDoctype
protected boolean fSeenRootElement
protected boolean fSeenRootElementEnd
protected boolean fSeenHeadElement
protected boolean fSeenBodyElement
| Constructor Detail |
public HTMLTagBalancer()
| Method Detail |
public java.lang.Boolean getFeatureDefault(java.lang.String featureId)
getFeatureDefault in interface HTMLComponentpublic java.lang.Object getPropertyDefault(java.lang.String propertyId)
getPropertyDefault in interface HTMLComponentpublic java.lang.String[] getRecognizedFeatures()
getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponentpublic java.lang.String[] getRecognizedProperties()
getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent
public void reset(org.apache.xerces.xni.parser.XMLComponentManager manager)
throws org.apache.xerces.xni.parser.XMLConfigurationException
reset in interface org.apache.xerces.xni.parser.XMLComponentorg.apache.xerces.xni.parser.XMLConfigurationException
public void setFeature(java.lang.String featureId,
boolean state)
throws org.apache.xerces.xni.parser.XMLConfigurationException
setFeature in interface org.apache.xerces.xni.parser.XMLComponentorg.apache.xerces.xni.parser.XMLConfigurationException
public void setProperty(java.lang.String propertyId,
java.lang.Object value)
throws org.apache.xerces.xni.parser.XMLConfigurationException
setProperty in interface org.apache.xerces.xni.parser.XMLComponentorg.apache.xerces.xni.parser.XMLConfigurationExceptionpublic void setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)
setDocumentHandler in interface org.apache.xerces.xni.parser.XMLDocumentSourcepublic org.apache.xerces.xni.XMLDocumentHandler getDocumentHandler()
getDocumentHandler in interface org.apache.xerces.xni.parser.XMLDocumentSource
public void startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.NamespaceContext nscontext,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
startDocument in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void xmlDecl(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
xmlDecl in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void doctypeDecl(java.lang.String rootElementName,
java.lang.String publicId,
java.lang.String systemId,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
doctypeDecl in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void endDocument(org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
endDocument in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void comment(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
comment in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void processingInstruction(java.lang.String target,
org.apache.xerces.xni.XMLString data,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
processingInstruction in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void startElement(org.apache.xerces.xni.QName elem,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
startElement in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void emptyElement(org.apache.xerces.xni.QName elem,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
emptyElement in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void startGeneralEntity(java.lang.String name,
org.apache.xerces.xni.XMLResourceIdentifier id,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
startGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void textDecl(java.lang.String version,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
textDecl in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void endGeneralEntity(java.lang.String name,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
endGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void startCDATA(org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
startCDATA in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void endCDATA(org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
endCDATA in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void characters(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
characters in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void ignorableWhitespace(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
ignorableWhitespace in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void endElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
endElement in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIExceptionpublic void setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
setDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandlerpublic org.apache.xerces.xni.parser.XMLDocumentSource getDocumentSource()
getDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandler
public void startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
org.apache.xerces.xni.XNIException
public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
org.apache.xerces.xni.XNIException
public void endPrefixMapping(java.lang.String prefix,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
org.apache.xerces.xni.XNIExceptionprotected HTMLElements.Element getElement(java.lang.String name)
protected final void callStartElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
org.apache.xerces.xni.XNIException
protected final void callEndElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
org.apache.xerces.xni.XNIExceptionprotected final int getElementDepth(HTMLElements.Element element)
element - The element.
protected int getParentDepth(HTMLElements.Element[] parents,
short bounds)
parents - The parent elements.protected final org.apache.xerces.xni.XMLAttributes emptyAttributes()
protected final org.apache.xerces.xni.Augmentations synthesizedAugs()
protected static final java.lang.String modifyName(java.lang.String name,
short mode)
protected static final short getNamesValue(java.lang.String value)
NAMES_NO_CHANGE,
NAMES_LOWERCASE,
NAMES_UPPERCASE
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||