Class ParsingContentHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.jackrabbit.commons.xml.DefaultContentHandler
-
- org.apache.jackrabbit.commons.xml.ParsingContentHandler
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class ParsingContentHandler extends DefaultContentHandler
Utility class that decorates aContentHandler
instance with simple XML parsing capability.- Since:
- Jackrabbit JCR Commons 1.5
-
-
Constructor Summary
Constructors Constructor Description ParsingContentHandler(ContentHandler handler)
Creates aDefaultHandler
adapter for the given content handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
parse(InputStream in)
Utility method that parses the given input stream using this handler.InputSource
resolveEntity(String publicId, String systemId)
Returns an empty stream to prevent the XML parser from attempting to resolve external entity references.-
Methods inherited from class org.apache.jackrabbit.commons.xml.DefaultContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
ParsingContentHandler
public ParsingContentHandler(ContentHandler handler)
Creates aDefaultHandler
adapter for the given content handler.- Parameters:
handler
- content handler
-
-
Method Detail
-
parse
public void parse(InputStream in) throws IOException, 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:
IOException
- if an I/O error occursSAXException
- if an XML parsing error occurs
-
resolveEntity
public InputSource resolveEntity(String publicId, String systemId) throws SAXException
Returns an empty stream to prevent the XML parser from attempting to resolve external entity references.- Specified by:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classDefaultHandler
- Throws:
SAXException
-
-