org.springframework.util.xml
Class StaxEventXMLReader

java.lang.Object
  extended by org.springframework.util.xml.AbstractXMLReader
      extended by org.springframework.util.xml.AbstractStaxXMLReader
          extended by org.springframework.util.xml.StaxEventXMLReader
All Implemented Interfaces:
org.xml.sax.XMLReader

 class StaxEventXMLReader
extends AbstractStaxXMLReader

SAX XMLReader that reads from a StAX XMLEventReader. Consumes XMLEvents from an XMLEventReader, and calls the corresponding methods on the SAX callback interfaces.

Since:
3.0
Author:
Arjen Poutsma
See Also:
XMLEventReader, AbstractXMLReader.setContentHandler(org.xml.sax.ContentHandler), AbstractXMLReader.setDTDHandler(org.xml.sax.DTDHandler), AbstractXMLReader.setEntityResolver(org.xml.sax.EntityResolver), AbstractXMLReader.setErrorHandler(org.xml.sax.ErrorHandler)

Field Summary
private static java.lang.String DEFAULT_XML_VERSION
           
private  java.lang.String encoding
           
private  java.util.Map<java.lang.String,java.lang.String> namespaces
           
private  javax.xml.stream.XMLEventReader reader
           
private  java.lang.String xmlVersion
           
 
Constructor Summary
StaxEventXMLReader(javax.xml.stream.XMLEventReader reader)
          Constructs a new instance of the StaxEventXmlReader that reads from the given XMLEventReader.
 
Method Summary
private  org.xml.sax.Attributes getAttributes(javax.xml.stream.events.StartElement event)
           
private  void handleCharacters(javax.xml.stream.events.Characters characters)
           
private  void handleComment(javax.xml.stream.events.Comment comment)
           
private  void handleDtd(javax.xml.stream.events.DTD dtd)
           
private  void handleEndDocument()
           
private  void handleEndElement(javax.xml.stream.events.EndElement endElement)
           
private  void handleEntityDeclaration(javax.xml.stream.events.EntityDeclaration entityDeclaration)
           
private  void handleEntityReference(javax.xml.stream.events.EntityReference reference)
           
private  void handleNotationDeclaration(javax.xml.stream.events.NotationDeclaration declaration)
           
private  void handleProcessingInstruction(javax.xml.stream.events.ProcessingInstruction pi)
           
private  void handleStartDocument(javax.xml.stream.events.XMLEvent event)
           
private  void handleStartElement(javax.xml.stream.events.StartElement startElement)
           
protected  void parseInternal()
          Template-method that parses the StAX reader passed at construction-time.
 
Methods inherited from class org.springframework.util.xml.AbstractStaxXMLReader
endPrefixMapping, getFeature, hasNamespacePrefixesFeature, hasNamespacesFeature, parse, parse, setFeature, setStandalone, startPrefixMapping, toQualifiedName
 
Methods inherited from class org.springframework.util.xml.AbstractXMLReader
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getLexicalHandler, getProperty, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_XML_VERSION

private static final java.lang.String DEFAULT_XML_VERSION
See Also:
Constant Field Values

reader

private final javax.xml.stream.XMLEventReader reader

namespaces

private final java.util.Map<java.lang.String,java.lang.String> namespaces

xmlVersion

private java.lang.String xmlVersion

encoding

private java.lang.String encoding
Constructor Detail

StaxEventXMLReader

StaxEventXMLReader(javax.xml.stream.XMLEventReader reader)
Constructs a new instance of the StaxEventXmlReader that reads from the given XMLEventReader. The supplied event reader must be in XMLStreamConstants.START_DOCUMENT or XMLStreamConstants.START_ELEMENT state.

Parameters:
reader - the XMLEventReader to read from
Throws:
java.lang.IllegalStateException - if the reader is not at the start of a document or element
Method Detail

parseInternal

protected void parseInternal()
                      throws org.xml.sax.SAXException,
                             javax.xml.stream.XMLStreamException
Description copied from class: AbstractStaxXMLReader
Template-method that parses the StAX reader passed at construction-time.

Specified by:
parseInternal in class AbstractStaxXMLReader
Throws:
org.xml.sax.SAXException
javax.xml.stream.XMLStreamException

handleStartDocument

private void handleStartDocument(javax.xml.stream.events.XMLEvent event)
                          throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleStartElement

private void handleStartElement(javax.xml.stream.events.StartElement startElement)
                         throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleCharacters

private void handleCharacters(javax.xml.stream.events.Characters characters)
                       throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleEndElement

private void handleEndElement(javax.xml.stream.events.EndElement endElement)
                       throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleEndDocument

private void handleEndDocument()
                        throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleNotationDeclaration

private void handleNotationDeclaration(javax.xml.stream.events.NotationDeclaration declaration)
                                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleEntityDeclaration

private void handleEntityDeclaration(javax.xml.stream.events.EntityDeclaration entityDeclaration)
                              throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleProcessingInstruction

private void handleProcessingInstruction(javax.xml.stream.events.ProcessingInstruction pi)
                                  throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleComment

private void handleComment(javax.xml.stream.events.Comment comment)
                    throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleDtd

private void handleDtd(javax.xml.stream.events.DTD dtd)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

handleEntityReference

private void handleEntityReference(javax.xml.stream.events.EntityReference reference)
                            throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getAttributes

private org.xml.sax.Attributes getAttributes(javax.xml.stream.events.StartElement event)