Class ParsingContentHandler

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class ParsingContentHandler
    extends DefaultContentHandler
    Utility class that decorates a ContentHandler instance with simple XML parsing capability.
    Since:
    Jackrabbit JCR Commons 1.5
    • Constructor Detail

      • ParsingContentHandler

        public ParsingContentHandler​(org.xml.sax.ContentHandler handler)
        Creates a DefaultHandler adapter for the given content handler.
        Parameters:
        handler - content handler
    • Method Detail

      • parse

        public void parse​(java.io.InputStream in)
                   throws java.io.IOException,
                          org.xml.sax.SAXException
        Utility method that parses the given input stream using this handler. The parser is namespace-aware and will not resolve external entity references.
        Parameters:
        in - XML input stream
        Throws:
        java.io.IOException - if an I/O error occurs
        org.xml.sax.SAXException - if an XML parsing error occurs
      • resolveEntity

        public org.xml.sax.InputSource resolveEntity​(java.lang.String publicId,
                                                     java.lang.String systemId)
                                              throws org.xml.sax.SAXException
        Returns an empty stream to prevent the XML parser from attempting to resolve external entity references.
        Specified by:
        resolveEntity in interface org.xml.sax.EntityResolver
        Overrides:
        resolveEntity in class org.xml.sax.helpers.DefaultHandler
        Throws:
        org.xml.sax.SAXException