public class HTMLTagBalancer extends java.lang.Object implements HTMLComponent
This component recognizes the following features:
This component recognizes the following properties:
HTMLElements
Modifier and Type | Class and Description |
---|---|
static class |
HTMLTagBalancer.Info
Element info for each start element.
|
static class |
HTMLTagBalancer.InfoStack
Unsynchronized stack of element information.
|
Modifier and Type | Field and Description |
---|---|
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 |
fAllowSelfclosingIframe
Allows self closing iframe tags.
|
protected boolean |
fAllowSelfclosingTags
Allows self closing tags.
|
protected boolean |
fAugmentations
Include infoset augmentations.
|
protected boolean |
fDocumentFragment
Document fragment balancing only.
|
protected XMLDocumentHandler |
fDocumentHandler
The document handler.
|
protected 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 |
fOpenedForm
True if a form is in the stack (allow to discard opening of nested forms)
|
static java.lang.String |
FRAGMENT_CONTEXT_STACK
EXPERIMENTAL: may change in next release
Name of the property holding the stack of elements in which context a document fragment should be parsed. |
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.
|
protected HTMLTagBalancingListener |
tagBalancingListener |
Constructor and Description |
---|
HTMLTagBalancer() |
Modifier and Type | Method and Description |
---|---|
protected void |
callEndElement(QName element,
Augmentations augs)
Call document handler end element.
|
protected void |
callStartElement(QName element,
XMLAttributes attrs,
Augmentations augs)
Call document handler start element.
|
void |
characters(XMLString text,
Augmentations augs)
Characters.
|
void |
comment(XMLString text,
Augmentations augs)
Comment.
|
void |
doctypeDecl(java.lang.String rootElementName,
java.lang.String publicId,
java.lang.String systemId,
Augmentations augs)
Doctype declaration.
|
protected XMLAttributes |
emptyAttributes()
Returns a set of empty attributes.
|
void |
emptyElement(QName element,
XMLAttributes attrs,
Augmentations augs)
Empty element.
|
void |
endCDATA(Augmentations augs)
End CDATA section.
|
void |
endDocument(Augmentations augs)
End document.
|
void |
endElement(QName element,
Augmentations augs)
End element.
|
void |
endGeneralEntity(java.lang.String name,
Augmentations augs)
End entity.
|
void |
endPrefixMapping(java.lang.String prefix,
Augmentations augs)
End prefix mapping.
|
XMLDocumentHandler |
getDocumentHandler()
Returns the document handler.
|
XMLDocumentSource |
getDocumentSource()
Returns the document source.
|
protected HTMLElements.Element |
getElement(QName elementName)
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(XMLString text,
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,
XMLString data,
Augmentations augs)
Processing instruction.
|
void |
reset(XMLComponentManager manager)
Resets the component.
|
void |
setDocumentHandler(XMLDocumentHandler handler)
Sets the document handler.
|
void |
setDocumentSource(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(Augmentations augs)
Start CDATA section.
|
void |
startDocument(XMLLocator locator,
java.lang.String encoding,
Augmentations augs)
Start document.
|
void |
startDocument(XMLLocator locator,
java.lang.String encoding,
NamespaceContext nscontext,
Augmentations augs)
Start document.
|
void |
startElement(QName elem,
XMLAttributes attrs,
Augmentations augs)
Start element.
|
void |
startGeneralEntity(java.lang.String name,
XMLResourceIdentifier id,
java.lang.String encoding,
Augmentations augs)
Start entity.
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri,
Augmentations augs)
Start prefix mapping.
|
protected Augmentations |
synthesizedAugs()
Returns an augmentations object with a synthesized item added.
|
void |
textDecl(java.lang.String version,
java.lang.String encoding,
Augmentations augs)
Text declaration.
|
void |
xmlDecl(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone,
Augmentations augs)
XML declaration.
|
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
public static final java.lang.String FRAGMENT_CONTEXT_STACK
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 boolean fAllowSelfclosingIframe
protected boolean fAllowSelfclosingTags
protected short fNamesElems
protected short fNamesAttrs
protected HTMLErrorReporter fErrorReporter
protected XMLDocumentSource fDocumentSource
protected 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
protected boolean fOpenedForm
protected HTMLTagBalancingListener tagBalancingListener
public java.lang.Boolean getFeatureDefault(java.lang.String featureId)
getFeatureDefault
in interface HTMLComponent
public java.lang.Object getPropertyDefault(java.lang.String propertyId)
getPropertyDefault
in interface HTMLComponent
public java.lang.String[] getRecognizedFeatures()
public java.lang.String[] getRecognizedProperties()
public void reset(XMLComponentManager manager) throws XMLConfigurationException
XMLConfigurationException
public void setFeature(java.lang.String featureId, boolean state) throws XMLConfigurationException
XMLConfigurationException
public void setProperty(java.lang.String propertyId, java.lang.Object value) throws XMLConfigurationException
XMLConfigurationException
public void setDocumentHandler(XMLDocumentHandler handler)
public XMLDocumentHandler getDocumentHandler()
public void startDocument(XMLLocator locator, java.lang.String encoding, NamespaceContext nscontext, Augmentations augs) throws XNIException
XNIException
public void xmlDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone, Augmentations augs) throws XNIException
XNIException
public void doctypeDecl(java.lang.String rootElementName, java.lang.String publicId, java.lang.String systemId, Augmentations augs) throws XNIException
XNIException
public void endDocument(Augmentations augs) throws XNIException
XNIException
public void comment(XMLString text, Augmentations augs) throws XNIException
XNIException
public void processingInstruction(java.lang.String target, XMLString data, Augmentations augs) throws XNIException
XNIException
public void startElement(QName elem, XMLAttributes attrs, Augmentations augs) throws XNIException
XNIException
public void emptyElement(QName element, XMLAttributes attrs, Augmentations augs) throws XNIException
XNIException
public void startGeneralEntity(java.lang.String name, XMLResourceIdentifier id, java.lang.String encoding, Augmentations augs) throws XNIException
XNIException
public void textDecl(java.lang.String version, java.lang.String encoding, Augmentations augs) throws XNIException
XNIException
public void endGeneralEntity(java.lang.String name, Augmentations augs) throws XNIException
XNIException
public void startCDATA(Augmentations augs) throws XNIException
XNIException
public void endCDATA(Augmentations augs) throws XNIException
XNIException
public void characters(XMLString text, Augmentations augs) throws XNIException
XNIException
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException
XNIException
public void endElement(QName element, Augmentations augs) throws XNIException
XNIException
public void setDocumentSource(XMLDocumentSource source)
public XMLDocumentSource getDocumentSource()
public void startDocument(XMLLocator locator, java.lang.String encoding, Augmentations augs) throws XNIException
XNIException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri, Augmentations augs) throws XNIException
XNIException
public void endPrefixMapping(java.lang.String prefix, Augmentations augs) throws XNIException
XNIException
protected HTMLElements.Element getElement(QName elementName)
protected final void callStartElement(QName element, XMLAttributes attrs, Augmentations augs) throws XNIException
XNIException
protected final void callEndElement(QName element, Augmentations augs) throws XNIException
XNIException
protected final int getElementDepth(HTMLElements.Element element)
element
- The element.protected int getParentDepth(HTMLElements.Element[] parents, short bounds)
parents
- The parent elements.protected final XMLAttributes emptyAttributes()
protected final 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
(C) Copyright 2002-2014, Andy Clark, Marc Guillemot. All rights reserved.