Documentation of 'javolution37.javolution.xml.sax.XmlSaxParserImpl' Java class
XmlSaxParserImpl
javolution37.javolution.xml.sax

Class XmlSaxParserImpl

  • All Implemented Interfaces:
    Reusable


    public class XmlSaxParserImpl
    extends java.lang.Object
    implements Reusable

    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

      Constructors 
      Constructor and Description
      XmlSaxParserImpl()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlSaxParserImpl

        public XmlSaxParserImpl()
        Default constructor.
    • Method Detail

      • setContentHandler

        public void setContentHandler(ContentHandler handler)
        Allows an application to register a real-time 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.

        Parameters:
        handler - the real-time content handler.
        Throws:
        java.lang.NullPointerException - if the handler argument is null.
        See Also:
        getContentHandler()
      • setErrorHandler

        public void setErrorHandler(org.xml.sax.ErrorHandler handler)
        Allows 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.

        Parameters:
        handler - the error handler.
        Throws:
        java.lang.NullPointerException - if the handler argument is null.
        See Also:
        getErrorHandler()
      • getErrorHandler

        public org.xml.sax.ErrorHandler getErrorHandler()
        Returns the current error handler.
        Returns:
        the current error handler, or null if none has been registered.
        See Also:
        setErrorHandler(org.xml.sax.ErrorHandler)
      • parse

        public void parse(java.io.InputStream in)
                   throws java.io.IOException,
                          org.xml.sax.SAXException
        Parses an XML document from the specified input stream (UTF-8 encoding).
        Parameters:
        in - the input stream with UTF-8 encoding.
        Throws:
        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.
        See Also:
        Utf8StreamReader
      • parse

        public void parse(java.nio.ByteBuffer byteBuffer)
                   throws java.io.IOException,
                          org.xml.sax.SAXException
        Parses an XML document from the specified ByteBuffer (UTF-8 encoding).
        Parameters:
        byteBuffer - the byte buffer with UTF-8 encoding.
        Throws:
        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.
        See Also:
        Utf8ByteBufferReader
      • parse

        public void parse(java.io.Reader reader)
                   throws java.io.IOException,
                          org.xml.sax.SAXException
        Parses an XML document using the specified reader.
        Parameters:
        reader - the document reader.
        Throws:
        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.
      • getFeature

        public boolean getFeature(java.lang.String name)
                           throws org.xml.sax.SAXNotRecognizedException,
                                  org.xml.sax.SAXNotSupportedException
        Looks up the value of a feature.

        Recognizes http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.

        Parameters:
        name - the feature name, which is a fully-qualified URI.
        Returns:
        the current state of the feature (true or false).
        Throws:
        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.
        See Also:
        setFeature(java.lang.String, boolean)
      • setFeature

        public void setFeature(java.lang.String name,
                               boolean value)
                        throws org.xml.sax.SAXNotRecognizedException,
                               org.xml.sax.SAXNotSupportedException
        Sets the state of a feature.

        Recognizes http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.

        Parameters:
        name - the feature name, which is a fully-qualified URI.
        value - the requested state of the feature (true or false).
        Throws:
        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.
        See Also:
        getFeature(java.lang.String)
      • getProperty

        public java.lang.Object getProperty(java.lang.String name)
                                     throws org.xml.sax.SAXNotRecognizedException,
                                            org.xml.sax.SAXNotSupportedException
        Looks up the value of a property.
        Parameters:
        name - the property name, which is a fully-qualified URI.
        Returns:
        the current value of the property.
        Throws:
        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.
        See Also:
        setProperty(java.lang.String, java.lang.Object)
      • setProperty

        public void setProperty(java.lang.String name,
                                java.lang.Object value)
                         throws org.xml.sax.SAXNotRecognizedException,
                                org.xml.sax.SAXNotSupportedException
        Sets the value of a property.
        Parameters:
        name - the property name, which is a fully-qualified URI.
        value - the requested value for the property.
        Throws:
        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.
      • setEntityResolver

        public void setEntityResolver(org.xml.sax.EntityResolver resolver)
        Allows an application to register an entity resolver (ignored by this parser).
        Parameters:
        resolver - the entity resolver.
      • getEntityResolver

        public org.xml.sax.EntityResolver getEntityResolver()
        Returns the current entity resolver.
        Returns:
        the current entity resolver, or null if none has been registered.
        See Also:
        setEntityResolver(org.xml.sax.EntityResolver)
      • setDTDHandler

        public void setDTDHandler(org.xml.sax.DTDHandler handler)
        Allows an application to register a DTD handler (ignored by this parser).
        Parameters:
        handler - the DTD handler.
      • getDTDHandler

        public org.xml.sax.DTDHandler getDTDHandler()
        Returns the current DTD handler.
        Returns:
        the current DTD handler, or null if none has been registered.
        See Also:
        setDTDHandler(org.xml.sax.DTDHandler)
      • reset

        public void reset()
        Description copied from interface: Reusable
        Resets the internal state of this object to its default values.
        Specified by:
        reset in interface Reusable

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.