Class ContentHandler
- java.lang.Object
-
- totalcross.xml.ContentHandler
-
- Direct Known Subclasses:
XmlRpcContentHandler
public abstract class ContentHandler extends java.lang.ObjectReceive notification of the logical content of a document.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 Summary
Constructors Constructor Description ContentHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcdata(int tag, java.lang.String cdata)Receive notification of cdata.abstract voidcharacters(java.lang.String s)Receive notification of character data.voidcomment(java.lang.String s)Receive notification of comment data.abstract voidendElement(int tag)Receive notification of the end of an element.abstract voidstartElement(int tag, AttributeList atts)Receive notification of the beginning of an element.
-
-
-
Method Detail
-
startElement
public abstract void startElement(int tag, AttributeList atts)Receive notification of the beginning of an element.The XmlReader will invoke this method at the beginning of every element in the XML document; there will be a corresponding
endElementevent 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.- Parameters:
tag- tag identifier for this elementatts- The attributes list attached to the element.
-
endElement
public abstract void endElement(int tag)
Receive notification of the end of an element.The XMLReader will invoke this method at the end of every element in the XML document; there will be a corresponding
startElementevent for every endElement event (even when the element is empty).- Parameters:
tag- tag identifier for this element
-
characters
public abstract void characters(java.lang.String s)
Receive notification of character data.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.
- Parameters:
s- The string of characters from the XML document.
-
comment
public void comment(java.lang.String s)
Receive notification of comment data.The XMLReader will call this method to report each chunk of comments. This XMLReader implementation returns all contiguous comment data in a single chunk.
- Parameters:
s- The string of characters from the XML document.
-
cdata
public void cdata(int tag, java.lang.String cdata)Receive notification of 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.- Parameters:
tag- tag identifier for this elementcdata- unparsed data from the XML document.- Since:
- TotalCross 1.27
-
-