org.apache.jackrabbit.commons.xml
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:
- 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 Summary |
ParsingContentHandler(org.xml.sax.ContentHandler handler)
Creates a DefaultHandler adapter for the given content
handler. |
|
Method Summary |
void |
parse(java.io.InputStream in)
Utility method that parses the given input stream using this handler. |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ParsingContentHandler
public ParsingContentHandler(org.xml.sax.ContentHandler handler)
- Creates a
DefaultHandler adapter for the given content
handler.
- Parameters:
handler - content handler
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
Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.