public abstract class ContentHandler
extends java.lang.Object
Note: While in the SAX 2.0 spirit, this implementation is not fully compliant. Speed and footprint took precedence over what the author judged being details.
This is the main interface that most SAX applications
implement: if the application needs to be informed of basic parsing
events, it implements this interface and registers an instance with
the XML reader using the XmlReader.setContentHandler(totalcross.xml.ContentHandler)
method. The XML reader uses the instance to report
basic document-related events like the start and end of elements
and character data.
The order of events in this interface is very important, and mirrors the order of information in the document itself. For example, all of an element's content (character data, processing instructions, and/or subelements) will appear, in order, between the startElement event and the corresponding endElement event.
Constructor and Description |
---|
ContentHandler() |
Modifier and Type | Method and Description |
---|---|
void |
cdata(int tag,
java.lang.String cdata)
Receive notification of cdata.
|
abstract void |
characters(java.lang.String s)
Receive notification of character data.
|
void |
comment(java.lang.String s)
Receive notification of comment data.
|
abstract void |
endElement(int tag)
Receive notification of the end of an element.
|
abstract void |
startElement(int tag,
AttributeList atts)
Receive notification of the beginning of an element.
|
void |
tagName(int tag,
java.lang.String name,
AttributeList atts)
Name of the tag.
|
public abstract void startElement(int tag, AttributeList atts)
The XmlReader will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
endElement
event for every startElement event
(even when the element is empty). All of the element's content will be
reported, in order, before the corresponding endElement
event.
tag
- tag identifier for this elementatts
- The attributes list attached to the element.public abstract void endElement(int tag)
The XMLReader will invoke this method at the end of every
element in the XML document; there will be a corresponding
startElement
event for every endElement
event (even when the element is empty).
tag
- tag identifier for this elementpublic abstract void characters(java.lang.String s)
The XMLReader will call this method to report each chunk of character data. This XMLReader implementation return all contiguous character data in a single chunk.
s
- The string of characters from the XML document.public void comment(java.lang.String s)
The XMLReader will call this method to report each chunk of comments. This XMLReader implementation returns all contiguous comment data in a single chunk.
s
- The string of characters from the XML document.public void cdata(int tag, java.lang.String cdata)
The XMLReader will call this method to report each chunk of cdata found during the parse. This XMLReader
implementation returns all contiguous data in a single chunk, except for the <![CDATA[
and
]]>
delimiters.
tag
- tag identifier for this elementcdata
- unparsed data from the XML document.public void tagName(int tag, java.lang.String name, AttributeList atts)
The XmlReader will invoke this method at the beginning of every element in the XML document. All of the element's content will be reported in order.
tag
- tag identifier for this elementname
- tag name