|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavolution.xml.sax.XmlSaxParserImpl
public class XmlSaxParserImpl
This class provides a real-time SAX2-like XML parser; this parser is extremely fast and does not create temporary objects (no garbage generated and no GC interruption).
The parser input source can be either a Reader,
an InputStream or even a ByteBuffer (e.g. MappedByteBuffer).
The parser is implemented as a SAX2 wrapper around the real-time
XmlPullParserImpl and share the same characteristics.
Note: This parser is a SAX2-like parser with the
java.lang.String type replaced by the more generic
java.lang.CharSequence in the ContentHandler,
Attributes interfaces and DefaultHandler base class.
If a standard SAX2 or JAXP parser is required, you may consider using
the wrapping class XMLReaderImpl. Fast but not as fast as
java.lang.String instances are dynamically allocated
while parsing.
| Constructor Summary | |
|---|---|
XmlSaxParserImpl()
Default constructor. |
|
| Method Summary | |
|---|---|
ContentHandler |
getContentHandler()
Returns the current real-time content handler. |
org.xml.sax.DTDHandler |
getDTDHandler()
Returns the current DTD handler. |
org.xml.sax.EntityResolver |
getEntityResolver()
Returns the current entity resolver. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Returns the current error handler. |
boolean |
getFeature(java.lang.String name)
Looks up the value of a feature. |
java.lang.Object |
getProperty(java.lang.String name)
Looks up the value of a property. |
void |
parse(java.nio.ByteBuffer byteBuffer)
Parses an XML document from the specified ByteBuffer
(UTF-8 encoding). |
void |
parse(java.io.InputStream in)
Parses an XML document from the specified input stream (UTF-8 encoding). |
void |
parse(java.io.Reader reader)
Parses an XML document using the specified reader. |
void |
reset()
Resets the internal state of this object to its default values. |
void |
setContentHandler(ContentHandler handler)
Allows an application to register a real-time content event handler. |
void |
setDTDHandler(org.xml.sax.DTDHandler handler)
Allows an application to register a DTD handler (ignored by this parser). |
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Allows an application to register an entity resolver (ignored by this parser). |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Allows an application to register an error event handler. |
void |
setFeature(java.lang.String name,
boolean value)
Sets the state of a feature. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets the value of a property. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlSaxParserImpl()
| Method Detail |
|---|
public void setContentHandler(ContentHandler 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.
handler - the real-time content handler.
java.lang.NullPointerException - if the handler argument is null.getContentHandler()public ContentHandler getContentHandler()
null
if none has been registered.setContentHandler(javolution.xml.sax.ContentHandler)public void setErrorHandler(org.xml.sax.ErrorHandler 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.
handler - the error handler.
java.lang.NullPointerException - if the handler argument is null.getErrorHandler()public org.xml.sax.ErrorHandler getErrorHandler()
null if none
has been registered.setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(java.io.InputStream in)
throws java.io.IOException,
org.xml.sax.SAXException
in - the input stream with UTF-8 encoding.
org.xml.sax.SAXException - any SAX exception, possibly
wrapping another exception.
java.io.IOException - an IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.Utf8StreamReader
public void parse(java.nio.ByteBuffer byteBuffer)
throws java.io.IOException,
org.xml.sax.SAXException
ByteBuffer
(UTF-8 encoding).
byteBuffer - the byte buffer with UTF-8 encoding.
org.xml.sax.SAXException - any SAX exception, possibly
wrapping another exception.
java.io.IOException - an IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.Utf8ByteBufferReader
public void parse(java.io.Reader reader)
throws java.io.IOException,
org.xml.sax.SAXException
reader - the document reader.
org.xml.sax.SAXException - any SAX exception, possibly wrapping another
exception.
java.io.IOException - an IO exception from the parser, possibly from
a byte stream or character stream supplied by the application.
public boolean getFeature(java.lang.String name)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
Recognizes http://xml.org/sax/features/namespaces
and the http://xml.org/sax/features/namespace-prefixes
feature names.
name - the feature name, which is a fully-qualified URI.
org.xml.sax.SAXNotRecognizedException - when the XMLReader does
not recognize the feature name.
org.xml.sax.SAXNotSupportedException - when the XMLReader
recognizes the feature name but cannot determine its value
at this time.setFeature(java.lang.String, boolean)
public void setFeature(java.lang.String name,
boolean value)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
Recognizes http://xml.org/sax/features/namespaces
and the http://xml.org/sax/features/namespace-prefixes
feature names.
name - the feature name, which is a fully-qualified URI.value - the requested state of the feature (true or false).
org.xml.sax.SAXNotRecognizedException - when the XMLReader does not
recognize the feature name.
org.xml.sax.SAXNotSupportedException - when the XMLReader
recognizes the feature name but cannot set the requested value.getFeature(java.lang.String)
public java.lang.Object getProperty(java.lang.String name)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
name - the property name, which is a fully-qualified URI.
org.xml.sax.SAXNotRecognizedException - when the
XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - when the
XMLReader recognizes the property name but
cannot determine its value at this time.setProperty(java.lang.String, java.lang.Object)
public void setProperty(java.lang.String name,
java.lang.Object value)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
name - the property name, which is a fully-qualified URI.value - the requested value for the property.
org.xml.sax.SAXNotRecognizedException - when the
XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - when the
XMLReader recognizes the property name but
cannot set the requested value.public void setEntityResolver(org.xml.sax.EntityResolver resolver)
resolver - the entity resolver.public org.xml.sax.EntityResolver getEntityResolver()
null if none
has been registered.setEntityResolver(org.xml.sax.EntityResolver)public void setDTDHandler(org.xml.sax.DTDHandler handler)
handler - the DTD handler.public org.xml.sax.DTDHandler getDTDHandler()
null if none
has been registered.setDTDHandler(org.xml.sax.DTDHandler)public void reset()
Reusable
reset in interface Reusable
|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||