|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.cyberneko.pull.util.BufferedPullConfiguration
An implementation of an XNI XMLPullParserConfiguration
that buffers the events so that one and only callback is performed
for each call to parse(boolean):boolean. In addition,
this class can be used to turn any XNI parser configuration, even
it doesn't implement XMLPullParserConfiguration, into
a fully buffered, pull parser configuration.
Note: There is a performance hit to buffering the underlying XNI events. While the difference is negligible for small documents, it becomes more pronounced as the document size increases.
EventCollector,
EventDispatcher| Field Summary | |
protected org.apache.xerces.xni.parser.XMLParserConfiguration |
fConfiguration
Parser configuration. |
protected org.apache.xerces.xni.XMLDocumentHandler |
fDocumentHandler
Document handler. |
protected EventCollector |
fEventCollector
Event collector. |
protected EventDispatcher |
fEventDispatcher
Event dispatcher. |
protected org.apache.xerces.xni.parser.XMLInputSource |
fInputSource
Input source. |
protected org.apache.xerces.xni.parser.XMLPullParserConfiguration |
fPullConfiguration
Pull parser configuration. |
| Constructor Summary | |
BufferedPullConfiguration(org.apache.xerces.xni.parser.XMLParserConfiguration config)
Constructs a buffered pull parser from the specified configuration. |
|
| Method Summary | |
void |
addRecognizedFeatures(java.lang.String[] featureIds)
Allows a parser to add parser specific features to be recognized and managed by the parser configuration. |
void |
addRecognizedProperties(java.lang.String[] propertyIds)
Allows a parser to add parser specific properties to be recognized and managed by the parser configuration. |
void |
cleanup()
If the application decides to terminate parsing before the xml document is fully parsed, the application should call this method to free any resource allocated during parsing. |
org.apache.xerces.xni.XMLDocumentHandler |
getDocumentHandler()
Returns the registered document handler. |
org.apache.xerces.xni.XMLDTDContentModelHandler |
getDTDContentModelHandler()
Returns the registered DTD content model handler. |
org.apache.xerces.xni.XMLDTDHandler |
getDTDHandler()
Returns the registered DTD handler. |
org.apache.xerces.xni.parser.XMLEntityResolver |
getEntityResolver()
Returns the registered entity resolver. |
org.apache.xerces.xni.parser.XMLErrorHandler |
getErrorHandler()
Returns the registered error handler. |
boolean |
getFeature(java.lang.String featureId)
Returns the state of a feature. |
java.util.Locale |
getLocale()
Returns the locale. |
java.lang.Object |
getProperty(java.lang.String propertyId)
Returns the value of a property. |
boolean |
parse(boolean complete)
Parses the document in a pull parsing fashion. |
void |
parse(org.apache.xerces.xni.parser.XMLInputSource inputSource)
Parse an XML document. |
protected void |
reset()
|
void |
setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler documentHandler)
Sets the document handler to receive information about the document. |
void |
setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler dtdContentModelHandler)
Sets the DTD content model handler. |
void |
setDTDHandler(org.apache.xerces.xni.XMLDTDHandler dtdHandler)
Sets the DTD handler. |
void |
setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
Sets the entity resolver. |
void |
setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Sets the error handler. |
void |
setFeature(java.lang.String featureId,
boolean state)
Sets the state of a feature. |
void |
setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)
Sets the input source for the document to parse. |
void |
setLocale(java.util.Locale locale)
Set the locale to use for messages. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object value)
Sets the value of a property. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected org.apache.xerces.xni.parser.XMLParserConfiguration fConfiguration
protected org.apache.xerces.xni.parser.XMLPullParserConfiguration fPullConfiguration
protected org.apache.xerces.xni.parser.XMLInputSource fInputSource
protected org.apache.xerces.xni.XMLDocumentHandler fDocumentHandler
protected EventCollector fEventCollector
protected EventDispatcher fEventDispatcher
| Constructor Detail |
public BufferedPullConfiguration(org.apache.xerces.xni.parser.XMLParserConfiguration config)
| Method Detail |
public void setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)
throws org.apache.xerces.xni.parser.XMLConfigurationException,
java.io.IOException
setInputSource in interface org.apache.xerces.xni.parser.XMLPullParserConfigurationinputSource - The document's input source.
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a
configuration error when initializing the
parser.
java.io.IOException - Thrown on I/O error.parse(boolean)
public boolean parse(boolean complete)
throws org.apache.xerces.xni.XNIException,
java.io.IOException
parse in interface org.apache.xerces.xni.parser.XMLPullParserConfigurationcomplete - True if the pull parser should parse the
remaining document completely.
org.apache.xerces.xni.XNIException - Any XNI exception, possibly wrapping
another exception.
java.io.IOException - An IO exception from the parser, possibly
from a byte stream or character stream
supplied by the parser.setInputSource(org.apache.xerces.xni.parser.XMLInputSource)public void cleanup()
cleanup in interface org.apache.xerces.xni.parser.XMLPullParserConfiguration
public void parse(org.apache.xerces.xni.parser.XMLInputSource inputSource)
throws org.apache.xerces.xni.XNIException,
java.io.IOException
The parser can use this method to instruct this configuration to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).
Parsers may not invoke this method while a parse is in progress. Once a parse is complete, the parser may then parse another XML document.
This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.
When this method returns, all characters streams and byte streams opened by the parser are closed.
parse in interface org.apache.xerces.xni.parser.XMLParserConfigurationorg.apache.xerces.xni.XNIException - Any XNI exception, possibly wrapping
another exception.
java.io.IOException - An IO exception from the parser, possibly
from a byte stream or character stream
supplied by the parser.public void addRecognizedFeatures(java.lang.String[] featureIds)
addRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLParserConfigurationfeatureIds - An array of the additional feature identifiers
to be recognized.
public void setFeature(java.lang.String featureId,
boolean state)
throws org.apache.xerces.xni.parser.XMLConfigurationException
setFeature in interface org.apache.xerces.xni.parser.XMLParserConfigurationfeatureId - The feature identifier.state - The state of the feature.
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration
error.
public boolean getFeature(java.lang.String featureId)
throws org.apache.xerces.xni.parser.XMLConfigurationException
getFeature in interface org.apache.xerces.xni.parser.XMLParserConfigurationfeatureId - The feature identifier.
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration
error.public void addRecognizedProperties(java.lang.String[] propertyIds)
addRecognizedProperties in interface org.apache.xerces.xni.parser.XMLParserConfigurationpropertyIds - An array of the additional property identifiers
to be recognized.
public void setProperty(java.lang.String propertyId,
java.lang.Object value)
throws org.apache.xerces.xni.parser.XMLConfigurationException
setProperty in interface org.apache.xerces.xni.parser.XMLParserConfigurationpropertyId - The property identifier.value - The value of the property.
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration
error.
public java.lang.Object getProperty(java.lang.String propertyId)
throws org.apache.xerces.xni.parser.XMLConfigurationException
getProperty in interface org.apache.xerces.xni.parser.XMLParserConfigurationpropertyId - The property identifier.
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration
error.public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
setErrorHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationerrorHandler - The error resolver.public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
getErrorHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationpublic void setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler documentHandler)
setDocumentHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationdocumentHandler - The document handler.public org.apache.xerces.xni.XMLDocumentHandler getDocumentHandler()
getDocumentHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationpublic void setDTDHandler(org.apache.xerces.xni.XMLDTDHandler dtdHandler)
setDTDHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationdtdHandler - The DTD handler.public org.apache.xerces.xni.XMLDTDHandler getDTDHandler()
getDTDHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationpublic void setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler dtdContentModelHandler)
setDTDContentModelHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationdtdContentModelHandler - The DTD content model handler.public org.apache.xerces.xni.XMLDTDContentModelHandler getDTDContentModelHandler()
getDTDContentModelHandler in interface org.apache.xerces.xni.parser.XMLParserConfigurationpublic void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
setEntityResolver in interface org.apache.xerces.xni.parser.XMLParserConfigurationentityResolver - The new entity resolver.public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
getEntityResolver in interface org.apache.xerces.xni.parser.XMLParserConfiguration
public void setLocale(java.util.Locale locale)
throws org.apache.xerces.xni.XNIException
setLocale in interface org.apache.xerces.xni.parser.XMLParserConfigurationlocale - The locale object to use for localization of messages.
org.apache.xerces.xni.XNIException - Thrown if the parser does not support the
specified locale.public java.util.Locale getLocale()
getLocale in interface org.apache.xerces.xni.parser.XMLParserConfiguration
protected void reset()
throws org.apache.xerces.xni.parser.XMLConfigurationException
org.apache.xerces.xni.parser.XMLConfigurationException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||