public class SAXEntityParser extends Object implements XMLReader
Default implementation cannot be used for parsing of XML document entities! It wraps client's parser that it actually used for performing the parsing task.
Primary use case (parse general entity):
XMLReader entityParser = new SAXEntityParser(xmlReader); entityParser.setErrorHandler(errorHandler); entityParser.parse(inputSource);Secondary use case (delegating parser): It requires subclassing and allow subclass entirely define internal wrapping logic. Warning: Implementation gurantees only proper ErrorHandler callbacks.
| Constructor and Description |
|---|
SAXEntityParser(XMLReader peer)
Creates a new instance of general entity parser.
|
SAXEntityParser(XMLReader peer,
boolean generalEntity)
Creates a new instance of SAXEntityParser.
|
| Modifier and Type | Method and Description |
|---|---|
ContentHandler |
getContentHandler() |
DTDHandler |
getDTDHandler() |
EntityResolver |
getEntityResolver() |
ErrorHandler |
getErrorHandler() |
boolean |
getFeature(String name) |
Object |
getProperty(String name) |
void |
parse(InputSource entity)
Start entity parsing using peer parser.
|
void |
parse(String sid) |
protected boolean |
propagateException(SAXParseException ex)
Examine if the exception should be propagated into client's
ErrorHandler. |
void |
setContentHandler(ContentHandler contentHandler) |
void |
setDTDHandler(DTDHandler dTDHandler) |
void |
setEntityResolver(EntityResolver entityResolver) |
void |
setErrorHandler(ErrorHandler errorHandler) |
void |
setFeature(String name,
boolean val) |
void |
setProperty(String name,
Object val) |
protected InputSource |
wrapInputSource(InputSource input)
Create wrapper input source.
|
public SAXEntityParser(XMLReader peer)
peer - parser that will be used for parsing. Wrapped parser is
exclusively owned by this class no other clients can share it.public SAXEntityParser(XMLReader peer, boolean generalEntity)
peer - parser that will be used for parsinggeneralEntity - if false treat entity as parameter
entity (i.e. DTD entities).public void parse(InputSource entity) throws IOException, SAXException
parse in interface XMLReaderentity - entity input sourceIOExceptionSAXExceptionprotected InputSource wrapInputSource(InputSource input)
EntityResolver redirects the first query to wrapped
InputSource.input - InputSource to be wrapped.protected boolean propagateException(SAXParseException ex)
ErrorHandler.ex - examined exceptiontrue if the exception originates from client's
InputSource and should be propagated.public ContentHandler getContentHandler()
getContentHandler in interface XMLReaderpublic DTDHandler getDTDHandler()
getDTDHandler in interface XMLReaderpublic EntityResolver getEntityResolver()
getEntityResolver in interface XMLReaderpublic ErrorHandler getErrorHandler()
getErrorHandler in interface XMLReaderpublic boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getFeature in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic void parse(String sid) throws IOException, SAXException
parse in interface XMLReaderIOExceptionSAXExceptionpublic void setContentHandler(ContentHandler contentHandler)
setContentHandler in interface XMLReaderpublic void setDTDHandler(DTDHandler dTDHandler)
setDTDHandler in interface XMLReaderpublic void setEntityResolver(EntityResolver entityResolver)
setEntityResolver in interface XMLReaderpublic void setErrorHandler(ErrorHandler errorHandler)
setErrorHandler in interface XMLReaderpublic void setFeature(String name, boolean val) throws SAXNotRecognizedException, SAXNotSupportedException
setFeature in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic void setProperty(String name, Object val) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionBuilt on May 16 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.