org.cyberneko.pull
Interface XMLPullParser

All Superinterfaces:
org.apache.xerces.xni.parser.XMLComponentManager, XMLEventIterator
All Known Implementing Classes:
Xerces2

public interface XMLPullParser
extends XMLEventIterator, org.apache.xerces.xni.parser.XMLComponentManager

This interface defines an XML pull parser built on top of the Xerces Native Interface (XNI). Using a pull parser, an application controls the parsing of an XML stream by requesting event objects returned by the nextEvent method of the XMLEventIterator interface. This is different than the traditional SAX paradigm in which the application registers handlers and document information is pushed by the parser to the handlers. For specific details, refer to the documentation.

Version:
$Id: XMLPullParser.java,v 1.2 2003/01/28 20:00:30 andyc Exp $
Author:
Andy Clark

Method Summary
 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 resources allocated during parsing.
 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.
 XMLEvent nextEvent()
          Returns the next event in the document or null if there are no more events.
 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.
 

Method Detail

setInputSource

public void setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)
                    throws org.apache.xerces.xni.parser.XMLConfigurationException,
                           java.io.IOException
Sets the input source for the document to parse.

Parameters:
inputSource - The document's input source.
Throws:
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.
See Also:
nextEvent(), cleanup()

cleanup

public 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 resources allocated during parsing. For example, close all opened streams.


setErrorHandler

public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Sets the error handler.

Parameters:
errorHandler - The error resolver.

getErrorHandler

public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
Returns the registered error handler.


setEntityResolver

public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
Sets the entity resolver.

Parameters:
entityResolver - The new entity resolver.

getEntityResolver

public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.


setLocale

public void setLocale(java.util.Locale locale)
               throws org.apache.xerces.xni.XNIException
Set the locale to use for messages.

Parameters:
locale - The locale object to use for localization of messages.
Throws:
org.apache.xerces.xni.XNIException - Thrown if the parser does not support the specified locale.

getLocale

public java.util.Locale getLocale()
Returns the locale.


setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws org.apache.xerces.xni.parser.XMLConfigurationException
Sets the state of a feature. This method is called by the parser and gets propagated to components in this parser configuration.

Parameters:
featureId - The feature identifier.
state - The state of the feature.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration error.

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws org.apache.xerces.xni.parser.XMLConfigurationException
Sets the value of a property. This method is called by the parser and gets propagated to components in this parser configuration.

Parameters:
propertyId - The property identifier.
value - The value of the property.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration error.

nextEvent

public XMLEvent nextEvent()
                   throws org.apache.xerces.xni.XNIException,
                          java.io.IOException
Returns the next event in the document or null if there are no more events.

Specified by:
nextEvent in interface XMLEventIterator
Throws:
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.
See Also:
setInputSource(org.apache.xerces.xni.parser.XMLInputSource)

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a feature.

Specified by:
getFeature in interface org.apache.xerces.xni.parser.XMLComponentManager
Parameters:
featureId - The feature identifier.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration error.

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the value of a property.

Specified by:
getProperty in interface org.apache.xerces.xni.parser.XMLComponentManager
Parameters:
propertyId - The property identifier.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown if there is a configuration error.


(C) Copyright 2002-2004, Andy Clark. All rights reserved.