This non-validating parser conforms to Extensible Markup Language (XML) 1.0 and Namespaces in XML specifications. The API supported by the parser are CLDC and JSR-280, a JavaME subset of JAXP and SAX2.
org.xml.sax.XMLReader
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final String | |
| private boolean | |
| private boolean | |
| private DefaultHandler | |
| private ContentHandler | |
| private DTDHandler | |
| private EntityResolver | |
| private ErrorHandler |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | bflash()
Implements abstract jdk. Reports characters and empties the parser's buffer. |
| protected void | bflash_ws()
Implements abstract jdk. Reports white space characters and empties the parser's buffer. |
| protected void | comm(char[]
The comment text starting from first character. text, int The number of characters in comment. length)Implements abstract jdk. Reports a comment. |
| protected void | docType(String
The name of the entity. name, String The public identifier of the entity or pubid, String null.The system identifier of the entity or sysid)null.Implements abstract jdk. Reports document type. |
| public int | Returns: Always returns -1 indicating the column number is not available.Implements jdk. Return the column number where the current document event ends. |
| public ContentHandler | Returns: The current content handler, or null if none has been registered.Implements jdk. Return the current content handler. |
| public DTDHandler | Returns: The current DTD handler, or null if none has been registered.Implements jdk. Return the current DTD handler. |
| public EntityResolver | Returns: The current entity resolver, or null if none has been registered.Implements jdk. Return the current entity resolver. |
| public ErrorHandler | Returns: The current error handler, or null if none has been registered.Implements jdk. Return the current error handler. |
| public boolean | getFeature(String name)
Implements jdk. Look up the value of a feature flag. |
| public int | Returns: Always returns -1 indicating the line number is not available.Implements jdk. Return the line number where the current document event ends. |
| public Object | getProperty(String name)
Implements jdk. Look up the value of a property. |
| public String | Returns: A string containing the public identifier, or null if none is available.Implements jdk. Return the public identifier for the current document event. |
| public String | Returns: A string containing the system identifier, or null if none is available.Implements jdk. Return the system identifier for the current document event. |
| protected void | newPrefix()
Implements abstract jdk. Reports new namespace prefix. |
| protected void | notDecl(String
The notation's name. name, String The notation's public identifier, or null if none was given. pubid, String The notation's system identifier, or null if none was given. sysid)Implements abstract jdk. Reports notation declaration. |
| protected void | panic(String
The problem description message. msg)Implements abstract jdk. Notifies the handler about fatal parsing error. |
| public void | parse(String
The system identifier (URI). systemId)Implements jdk. Parse an XML document from a system identifier (URI). |
| public void | parse(InputSource
The input source for the top-level of the XML document. is)Implements jdk. Parse an XML document. |
| public void | parse(InputStream
InputStream containing the content to be parsed. src, DefaultHandler The SAX DefaultHandler to use. handler)Parse the content of the given |
| public void | parse(InputSource
The InputSource containing the content to be parsed. is, DefaultHandler The SAX DefaultHandler to use. handler)Parse the content given |
| private void | |
| protected void | pi(String
The processing instruction target name. target, String The processing instruction body text. body)Implements abstract jdk. Reports a processing instruction. |
| protected InputSource | resolveEnt(String
The name of the entity. name, String The public identifier of the entity. pubid, String The system identifier of the entity. sysid)Implements abstract jdk. Returns an
|
| public void | setContentHandler(ContentHandler
The content handler. handler)Implements jdk. Allow an application to register a content event handler. |
| public void | setDTDHandler(DTDHandler
The DTD handler. handler)Implements jdk. Allow an application to register a DTD event handler. |
| public void | setEntityResolver(EntityResolver
The entity resolver. resolver)Implements jdk. Allow an application to register an entity resolver. |
| public void | setErrorHandler(ErrorHandler
The error handler. handler)Implements jdk. Allow an application to register an error event handler. |
| public void | setFeature(String name, boolean value)
Implements jdk. Set the value of a feature flag. |
| public void | setProperty(String name, Object value)
Implements jdk. Set the value of a property. |
| protected void | skippedEnt(String
The entity name. name)Implements abstract jdk. Reports skipped entity name. |
| public void | startInternalSub()
Implements abstract jdk. Reports the start of DTD internal subset. |
| protected void | unparsedEntDecl(String
The unparsed entity's name. name, String The entity's public identifier, or null if none was given. pubid, String The entity's system identifier. sysid, String The name of the associated notation. notation)Implements abstract jdk. Reports unparsed entity name. |
| FEATURE_NS | back to summary |
|---|---|
| public static final String FEATURE_NS | |
| FEATURE_PREF | back to summary |
|---|---|
| public static final String FEATURE_PREF | |
| mFNamespaces | back to summary |
|---|---|
| private boolean mFNamespaces | |
| mFPrefixes | back to summary |
|---|---|
| private boolean mFPrefixes | |
| mHand | back to summary |
|---|---|
| private DefaultHandler mHand | |
| mHandCont | back to summary |
|---|---|
| private ContentHandler mHandCont | |
| mHandDtd | back to summary |
|---|---|
| private DTDHandler mHandDtd | |
| mHandEnt | back to summary |
|---|---|
| private EntityResolver mHandEnt | |
| mHandErr | back to summary |
|---|---|
| private ErrorHandler mHandErr | |
| ParserSAX | back to summary |
|---|---|
| public ParserSAX() Constructor. | |
| bflash | back to summary |
|---|---|
| protected void bflash() throws SAXException Implements abstract jdk. Reports characters and empties the parser's buffer. This method is called only if parser is going to return control to the main loop. This means that this method may use parser buffer to report white space without copying characters to temporary buffer. | |
| bflash_ws | back to summary |
|---|---|
| protected void bflash_ws() throws SAXException Implements abstract jdk. Reports white space characters and empties the parser's buffer. This method is called only if parser is going to return control to the main loop. This means that this method may use parser buffer to report white space without copying characters to temporary buffer. | |
| comm | back to summary |
|---|---|
| protected void comm(char[] text, int length) Implements abstract jdk. Reports a comment.
| |
| docType | back to summary |
|---|---|
| protected void docType(String name, String pubid, String sysid) throws SAXException Implements abstract jdk. Reports document type. | |
| getColumnNumber | back to summary |
|---|---|
| public int getColumnNumber() Implements jdk. Return the column number where the current document event ends.
| |
| getContentHandler | back to summary |
|---|---|
| public ContentHandler getContentHandler() Implements jdk. Return the current content handler.
| |
| getDTDHandler | back to summary |
|---|---|
| public DTDHandler getDTDHandler() Implements jdk. Return the current DTD handler.
| |
| getEntityResolver | back to summary |
|---|---|
| public EntityResolver getEntityResolver() Implements jdk. Return the current entity resolver.
| |
| getErrorHandler | back to summary |
|---|---|
| public ErrorHandler getErrorHandler() Implements jdk. Return the current error handler.
| |
| getFeature | back to summary |
|---|---|
| public boolean getFeature(String name) Implements jdk. Doc from jdk. Look up the value of a feature flag. The feature name is any fully-qualified URI. It is
possible for an XMLReader to recognize a feature name but
temporarily be unable to return its value.
Some feature values may be available only in specific
contexts, such as before, during, or after a parse.
Also, some feature values may not be programmatically accessible.
(In the case of an adapter for SAX1 All XMLReaders are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names. Typical usage is something like this:
XMLReader r = new MySAXDriver();
// try to activate validation
try {
r.setFeature("http://xml.org/sax/features/validation", true);
} catch (SAXException e) {
System.err.println("Cannot activate validation.");
}
// register event handlers
r.setContentHandler(new MyContentHandler());
r.setErrorHandler(new MyErrorHandler());
// parse the first document
try {
r.parse("http://www.foo.com/mydoc.xml");
} catch (IOException e) {
System.err.println("I/O exception reading XML document");
} catch (SAXException e) {
System.err.println("XML exception reading document.");
}
Implementors are free (and encouraged) to invent their own features, using names built on their own URIs. | |
| getLineNumber | back to summary |
|---|---|
| public int getLineNumber() Implements jdk. Return the line number where the current document event ends.
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String name) Implements jdk. Doc from jdk. Look up the value of a property. The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but temporarily be unable to return its value. Some property values may be available only in specific contexts, such as before, during, or after a parse. XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2. Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs. | |
| getPublicId | back to summary |
|---|---|
| public String getPublicId() Implements jdk. Return the public identifier for the current document event. The return value is the public identifier of the document entity or of the external parsed entity in which the markup triggering the event appears.
| |
| getSystemId | back to summary |
|---|---|
| public String getSystemId() Implements jdk. Return the system identifier for the current document event. The return value is the system identifier of the document entity or of the external parsed entity in which the markup triggering the event appears. If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
| |
| newPrefix | back to summary |
|---|---|
| protected void newPrefix() throws SAXException Implements abstract jdk. Reports new namespace prefix. The Namespace prefix (
| |
| notDecl | back to summary |
|---|---|
| protected void notDecl(String name, String pubid, String sysid) throws SAXException Implements abstract jdk. Reports notation declaration. | |
| panic | back to summary |
|---|---|
| protected void panic(String msg) throws SAXException Implements abstract jdk. Notifies the handler about fatal parsing error.
| |
| parse | back to summary |
|---|---|
| public void parse(String systemId) throws IOException, SAXException Implements jdk. Parse an XML document from a system identifier (URI). This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following: parse(new InputSource(systemId)); If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.
| |
| parse | back to summary |
|---|---|
| public void parse(InputSource is) throws IOException, SAXException Implements jdk. Parse an XML document. The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI). Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source. During the parse, the XMLReader will provide information about the XML document through the registered event handlers. This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.
| |
| parse | back to summary |
|---|---|
| public void parse(InputStream src, DefaultHandler handler) throws SAXException, IOException Parse the content of the given
| |
| parse | back to summary |
|---|---|
| public void parse(InputSource is, DefaultHandler handler) throws SAXException, IOException Parse the content given
| |
| parse | back to summary |
|---|---|
| private void parse() throws SAXException, IOException Parse the XML document content using specified handlers and an input source.
| |
| pi | back to summary |
|---|---|
| protected void pi(String target, String body) throws SAXException Implements abstract jdk. Reports a processing instruction. | |
| resolveEnt | back to summary |
|---|---|
| protected InputSource resolveEnt(String name, String pubid, String sysid) throws SAXException, IOException Implements abstract jdk. Returns an
| |
| setContentHandler | back to summary |
|---|---|
| public void setContentHandler(ContentHandler handler) Implements jdk. Allow an application to register a content event handler. If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored. Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
| |
| setDTDHandler | back to summary |
|---|---|
| public void setDTDHandler(DTDHandler handler) Implements jdk. Allow an application to register a DTD event handler. If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored. Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
| |
| setEntityResolver | back to summary |
|---|---|
| public void setEntityResolver(EntityResolver resolver) Implements jdk. Allow an application to register an entity resolver. If the application does not register an entity resolver, the XMLReader will perform its own default resolution. Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler handler) Implements jdk. Allow an application to register an error event handler. If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs. Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
| |
| setFeature | back to summary |
|---|---|
| public void setFeature(String name, boolean value) Implements jdk. Doc from jdk. Set the value of a feature flag. The feature name is any fully-qualified URI. It is possible for an XMLReader to expose a feature value but to be unable to change the current value. Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse. All XMLReaders are required to support setting http://xml.org/sax/features/namespaces to true and http://xml.org/sax/features/namespace-prefixes to false. | |
| setProperty | back to summary |
|---|---|
| public void setProperty(String name, Object value) Implements jdk. Doc from jdk. Set the value of a property. The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to change the current value. Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a parse. XMLReaders are not required to recognize setting any specific property names, though a core set is defined by SAX2. This method is also the standard mechanism for setting extended handlers. | |
| skippedEnt | back to summary |
|---|---|
| protected void skippedEnt(String name) throws SAXException Implements abstract jdk. Reports skipped entity name.
| |
| startInternalSub | back to summary |
|---|---|
| public void startInternalSub() throws SAXException Implements abstract jdk. Reports the start of DTD internal subset.
| |
| unparsedEntDecl | back to summary |
|---|---|
| protected void unparsedEntDecl(String name, String pubid, String sysid, String notation) throws SAXException Implements abstract jdk. Reports unparsed entity name. | |