| Modifier and Type | Class and Description |
|---|---|
| private static class | JAXPParser.
XMLReader with improved error message for entity resolution failure. |
| Modifier and Type | Field and Description |
|---|---|
| private final SAXParserFactory | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public | JAXPParser(SAXParserFactory factory)
Creates a new JAXPParser that uses the given SAXParserFactory for creating new XMLReaders. |
| Modifier and Type | Method and Description |
|---|---|
| private static SAXParser | |
| public void | parse(InputSource source, ContentHandler handler, ErrorHandler errorHandler, EntityResolver entityResolver)
Implements com. Parses the document identified by the given input source and sends SAX events to the given content handler. |
| factory | back to summary |
|---|---|
| private final SAXParserFactory factory | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| JAXPParser | back to summary |
|---|---|
| public JAXPParser(SAXParserFactory factory) Creates a new JAXPParser that uses the given SAXParserFactory for creating new XMLReaders.
The caller needs to configure
it properly with security features initialized by setting
XMLConstants.FEATURE_SECURE_PROCESSING feature.
Also don't forget to call | |
| allowFileAccess | back to summary |
|---|---|
| private static SAXParser allowFileAccess(SAXParser saxParser, boolean disableSecureProcessing) throws SAXException | |
| parse | back to summary |
|---|---|
| public void parse(InputSource source, ContentHandler handler, ErrorHandler errorHandler, EntityResolver entityResolver) throws SAXException, IOException Implements com. Doc from com. Parses the document identified by the given input source and sends SAX events to the given content handler. This method must be re-entrant.
| |
Todo
this class is completely stand-alone, so it shouldn't be an inner class.
| Modifier and Type | Field and Description |
|---|---|
| private Locator |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public InputSource | resolveEntity(String publicId, String systemId)
Overrides org. Implements org. Resolves entities and reports user-friendly error messages. |
| public void | setDocumentLocator(Locator locator)
Overrides org. Implements org. Filter a new document locator event. |
| locator | back to summary |
|---|---|
| private Locator locator | |
| XMLReaderEx | back to summary |
|---|---|
| pack-priv XMLReaderEx(XMLReader parent) | |
| resolveEntity | back to summary |
|---|---|
| public InputSource resolveEntity(String publicId, String systemId) throws SAXException Overrides org. Implements org. Resolves entities and reports user-friendly error messages. Some XML parser (at least Xerces) does not report much information when it fails to resolve an entity, which is often quite frustrating. For example, if you are behind a firewall and the schema contains a reference to www.w3.org, and there is no entity resolver, the parser will just throw an IOException that doesn't contain any information about where that reference occurs nor what it is accessing. By implementing an EntityResolver and resolving the reference by ourselves, we can report an error message with all the necessary information to fix the problem. Note that we still need to the client-specified entity resolver to let the application handle entity resolution. Here we just catch an IOException and add more information.
| |
| setDocumentLocator | back to summary |
|---|---|
| public void setDocumentLocator(Locator locator) Overrides org. Implements org. Doc from org. Filter a new document locator event.
| |