SAXContentHandler builds W3C DOM object via SAX events.
| Modifier and Type | Field and Description |
|---|---|
| private StringBuffer | cdataText
buffer to hold contents of cdata section across multiple characters events |
| private Element | currentElement
The current element we are on |
| private int | declaredNamespaceIndex
The number of namespaces that are declared in the current scope |
| private Document | document
The document that is being built |
| private DOMDocumentFactory | documentFactory
The factory used to create new |
| private ElementStack | elementStack
stack of |
| private EntityResolver | entityResolver
The entity resolver |
| private boolean | ignoreComments
Should we ignore comments |
| private InputSource | |
| private boolean | insideCDATASection
Flag used to indicate that we are inside a CDATA section |
| private Locator | locator
the Locator |
| private boolean | mergeAdjacentText
Whether adjacent text nodes should be merged |
| private NamespaceStack | namespaceStack
stack of |
| private boolean | stripWhitespaceText
Holds value of property stripWhitespaceText. |
| private StringBuffer | textBuffer
Buffer used to concatenate text together |
| private boolean | textInTextBuffer
Have we added text to the buffer |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | |
| protected String | |
| public void | characters(char[]
The characters. ch, int The start position in the character array. start, int The number of characters to use from the
character array. end)Overrides org. Implements org. |
| public void | comment(char[]
An array holding the characters in the comment. ch, int The starting position in the array. start, int The number of characters to use from the array. end)Implements org. |
| protected void | |
| protected Document | |
| protected ElementStack | |
| public void | |
| public void | endDocument()
Overrides org. Implements org. |
| public void | |
| public void | endElement(String
The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed. namespaceURI, String The local name (without prefix), or the
empty string if Namespace processing is not being
performed. localName, String The qualified name (with prefix), or the
empty string if qualified names are not available. qName)Overrides org. Implements org. |
| public void | endEntity(String
The name of the entity that is ending. name)Implements org. |
| public void | endPrefixMapping(String
The Namespace prefix being declared. prefix)Overrides org. Implements org. |
| public void | error(SAXParseException
DOCUMENT ME! exception)Overrides org. Implements org. |
| public void | fatalError(SAXParseException
DOCUMENT ME! exception)Overrides org. Implements org. |
| public Document | Returns: the document that has been or is being builtRetrieves w3c document object built via generated sax events. |
| public ElementStack | |
| private String | |
| public EntityResolver | |
| public InputSource | |
| public boolean | |
| public boolean | Returns: Value of property mergeAdjacentText.Returns whether adjacent text nodes should be merged together. |
| public boolean | Returns: Value of property stripWhitespaceText.Sets whether whitespace between element start and end tags should be ignored |
| public void | processingInstruction(String
The processing instruction target. target, String The processing instruction data, or null if
none is supplied. data)Overrides org. Implements org. |
| public void | setDocumentLocator(Locator
A locator for all SAX document events. documentLocator)Overrides org. Implements org. |
| public void | |
| public void | |
| public void | setIgnoreComments(boolean
whether we should ignore comments or not. ignoreComments)Sets whether we should ignore comments or not. |
| public void | |
| public void | setMergeAdjacentText(boolean
New value of property mergeAdjacentText. mergeAdjacentText)Sets whether or not adjacent text nodes should be merged together when parsing. |
| public void | setStripWhitespaceText(boolean
New value of property stripWhitespaceText. stripWhitespaceText)Sets whether whitespace between element start and end tags should be ignored. |
| public void | startCDATA()
Implements org. |
| public void | startDocument()
Overrides org. Implements org. |
| public void | startDTD(String
The document type name. name, String The declared public identifier for the
external DTD subset, or null if none was declared. publicId, String The declared system identifier for the
external DTD subset, or null if none was declared.
(Note that this is not resolved against the document
base URI.) systemId)Implements org. |
| public void | startElement(String
The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed. namespaceURI, String The local name (without prefix), or the
empty string if Namespace processing is not being
performed. localName, String The qualified name (with prefix), or the
empty string if qualified names are not available. qualifiedName, Attributes The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object. attributes)Overrides org. Implements org. |
| public void | startEntity(String
The name of the entity. If it is a parameter
entity, the name will begin with '%', and if it is the
external DTD subset, it will be "[dtd]". name)Implements org. |
| public void | startPrefixMapping(String
The Namespace prefix being declared. prefix, String The Namespace URI mapped to the prefix. uri)Overrides org. Implements org. |
| public void | warning(SAXParseException
DOCUMENT ME! exception)Overrides org. Implements org. |
| cdataText | back to summary |
|---|---|
| private StringBuffer cdataText buffer to hold contents of cdata section across multiple characters events | |
| currentElement | back to summary |
|---|---|
| private Element currentElement The current element we are on | |
| declaredNamespaceIndex | back to summary |
|---|---|
| private int declaredNamespaceIndex The number of namespaces that are declared in the current scope | |
| document | back to summary |
|---|---|
| private Document document The document that is being built | |
| documentFactory | back to summary |
|---|---|
| private DOMDocumentFactory documentFactory The factory used to create new | |
| elementStack | back to summary |
|---|---|
| private ElementStack elementStack stack of | |
| entityResolver | back to summary |
|---|---|
| private EntityResolver entityResolver The entity resolver | |
| ignoreComments | back to summary |
|---|---|
| private boolean ignoreComments Should we ignore comments | |
| inputSource | back to summary |
|---|---|
| private InputSource inputSource | |
| insideCDATASection | back to summary |
|---|---|
| private boolean insideCDATASection Flag used to indicate that we are inside a CDATA section | |
| locator | back to summary |
|---|---|
| private Locator locator the Locator | |
| mergeAdjacentText | back to summary |
|---|---|
| private boolean mergeAdjacentText Whether adjacent text nodes should be merged | |
| namespaceStack | back to summary |
|---|---|
| private NamespaceStack namespaceStack stack of | |
| stripWhitespaceText | back to summary |
|---|---|
| private boolean stripWhitespaceText Holds value of property stripWhitespaceText. | |
| textBuffer | back to summary |
|---|---|
| private StringBuffer textBuffer Buffer used to concatenate text together | |
| textInTextBuffer | back to summary |
|---|---|
| private boolean textInTextBuffer Have we added text to the buffer | |
| DOMSAXContentHandler | back to summary |
|---|---|
| public DOMSAXContentHandler() | |
| DOMSAXContentHandler | back to summary |
|---|---|
| public DOMSAXContentHandler(DOMDocumentFactory documentFactory) | |
| addAttributes | back to summary |
|---|---|
| protected void addAttributes(Element element, Attributes attributes) | |
| addDeclaredNamespaces | back to summary |
|---|---|
| protected void addDeclaredNamespaces(Element element) | |
| attributeNameForNamespace | back to summary |
|---|---|
| protected String attributeNameForNamespace(Namespace namespace) | |
| characters | back to summary |
|---|---|
| public void characters(char[] ch, int start, int end) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of character data inside an element. By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).
| |
| comment | back to summary |
|---|---|
| public void comment(char[] ch, int start, int end) throws SAXException Implements org. Doc from org. Report an XML comment anywhere in the document. This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).
| |
| completeCurrentTextNode | back to summary |
|---|---|
| protected void completeCurrentTextNode() | |
| createDocument | back to summary |
|---|---|
| protected Document createDocument() | |
| createElementStack | back to summary |
|---|---|
| protected ElementStack createElementStack() | |
| endCDATA | back to summary |
|---|---|
| public void endCDATA() throws SAXException Implements org. Doc from org. Report the end of a CDATA section.
| |
| endDocument | back to summary |
|---|---|
| public void endDocument() throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the end of the document. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalising a tree or closing an output file).
| |
| endDTD | back to summary |
|---|---|
| public void endDTD() throws SAXException Implements org. Doc from org. Report the end of DTD declarations. This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
| |
| endElement | back to summary |
|---|---|
| public void endElement(String namespaceURI, String localName, String qName) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the end of an element. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).
| |
| endEntity | back to summary |
|---|---|
| public void endEntity(String name) throws SAXException Implements org. Doc from org. Report the end of an entity.
| |
| endPrefixMapping | back to summary |
|---|---|
| public void endPrefixMapping(String prefix) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the end of a Namespace mapping. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each prefix mapping.
| |
| error | back to summary |
|---|---|
| public void error(SAXParseException exception) throws SAXException Overrides org. Implements org. This method is called when an error is detected during parsing such as a validation error. This method rethrows the exception
| |
| fatalError | back to summary |
|---|---|
| public void fatalError(SAXParseException exception) throws SAXException Overrides org. Implements org. This method is called when a fatal error occurs during parsing. This method rethrows the exception
| |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Retrieves w3c document object built via generated sax events.
| |
| getElementStack | back to summary |
|---|---|
| public ElementStack getElementStack() | |
| getEncoding | back to summary |
|---|---|
| private String getEncoding() | |
| getEntityResolver | back to summary |
|---|---|
| public EntityResolver getEntityResolver() | |
| getInputSource | back to summary |
|---|---|
| public InputSource getInputSource() | |
| isIgnoreComments | back to summary |
|---|---|
| public boolean isIgnoreComments() Returns whether we should ignore comments or not.
| |
| isMergeAdjacentText | back to summary |
|---|---|
| public boolean isMergeAdjacentText() Returns whether adjacent text nodes should be merged together.
| |
| isStripWhitespaceText | back to summary |
|---|---|
| public boolean isStripWhitespaceText() Sets whether whitespace between element start and end tags should be ignored
| |
| processingInstruction | back to summary |
|---|---|
| public void processingInstruction(String target, String data) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of a processing instruction. By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.
| |
| setDocumentLocator | back to summary |
|---|---|
| public void setDocumentLocator(Locator documentLocator) Overrides org. Implements org. Doc from org. Receive a Locator object for document events. By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.
| |
| setElementStack | back to summary |
|---|---|
| public void setElementStack(ElementStack elementStack) | |
| setEntityResolver | back to summary |
|---|---|
| public void setEntityResolver(EntityResolver entityResolver) | |
| setIgnoreComments | back to summary |
|---|---|
| public void setIgnoreComments(boolean ignoreComments) Sets whether we should ignore comments or not.
| |
| setInputSource | back to summary |
|---|---|
| public void setInputSource(InputSource inputSource) | |
| setMergeAdjacentText | back to summary |
|---|---|
| public void setMergeAdjacentText(boolean mergeAdjacentText) Sets whether or not adjacent text nodes should be merged together when parsing.
| |
| setStripWhitespaceText | back to summary |
|---|---|
| public void setStripWhitespaceText(boolean stripWhitespaceText) Sets whether whitespace between element start and end tags should be ignored.
| |
| startCDATA | back to summary |
|---|---|
| public void startCDATA() throws SAXException Implements org. Doc from org. Report the start of a CDATA section. The contents of the CDATA section will be reported through
the regular
| |
| startDocument | back to summary |
|---|---|
| public void startDocument() throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the beginning of the document. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).
| |
| startDTD | back to summary |
|---|---|
| public void startDTD(String name, String publicId, String systemId) throws SAXException Implements org. Doc from org. Report the start of DTD declarations, if any. This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked. All declarations reported through
Note that the start/endDTD events will appear within
the start/endDocument events from ContentHandler and
before the first
| |
| startElement | back to summary |
|---|---|
| public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the start of an element. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).
| |
| startEntity | back to summary |
|---|---|
| public void startEntity(String name) throws SAXException Implements org. Doc from org. Report the beginning of some internal and external XML entities. The reporting of parameter entities (including
the external DTD subset) is optional, and SAX2 drivers that
report LexicalHandler events may not implement it; you can use the
General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]". When a SAX2 driver is providing these events, all other
events must be properly nested within start/end entity
events. There is no additional requirement that events from
Note that skipped entities will be reported through the
Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:
These will be silently expanded, with no indication of where the original entity boundaries were. Note also that the boundaries of character references (which are not really entities anyway) are not reported. All start/endEntity events must be properly nested.
| |
| startPrefixMapping | back to summary |
|---|---|
| public void startPrefixMapping(String prefix, String uri) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the start of a Namespace mapping. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each Namespace prefix scope (such as storing the prefix mapping).
| |
| warning | back to summary |
|---|---|
| public void warning(SAXParseException exception) throws SAXException Overrides org. Implements org. This method is called when a warning occurs during the parsing of the document. This method does nothing.
| |