org.springframework.xml.stream
Class AbstractStaxContentHandler

java.lang.Object
  extended by org.springframework.xml.stream.AbstractStaxContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler
Direct Known Subclasses:
StaxEventContentHandler, StaxStreamContentHandler

public abstract class AbstractStaxContentHandler
extends Object
implements org.xml.sax.ContentHandler

Abstract base class for SAX ContentHandler implementations that use StAX as a basis. All methods delegate to internal template methods, capable of throwing a XMLStreamException. Additionally, an namespace context is used to keep track of declared namespaces.

Since:
1.0.0
Author:
Arjen Poutsma

Constructor Summary
AbstractStaxContentHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
protected abstract  void charactersInternal(char[] ch, int start, int length)
           
 void endDocument()
           
protected abstract  void endDocumentInternal()
           
 void endElement(String uri, String localName, String qName)
           
protected abstract  void endElementInternal(javax.xml.namespace.QName name, SimpleNamespaceContext namespaceContext)
           
 void endPrefixMapping(String prefix)
          Removes the binding for the given prefix.
 void ignorableWhitespace(char[] ch, int start, int length)
           
protected abstract  void ignorableWhitespaceInternal(char[] ch, int start, int length)
           
 void processingInstruction(String target, String data)
           
protected abstract  void processingInstructionInternal(String target, String data)
           
 void skippedEntity(String name)
           
protected abstract  void skippedEntityInternal(String name)
           
 void startDocument()
           
protected abstract  void startDocumentInternal()
           
 void startElement(String uri, String localName, String qName, org.xml.sax.Attributes atts)
           
protected abstract  void startElementInternal(javax.xml.namespace.QName name, org.xml.sax.Attributes atts, SimpleNamespaceContext namespaceContext)
           
 void startPrefixMapping(String prefix, String uri)
          Binds the given prefix to the given namespaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
setDocumentLocator
 

Constructor Detail

AbstractStaxContentHandler

public AbstractStaxContentHandler()
Method Detail

startDocument

public final void startDocument()
                         throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startDocumentInternal

protected abstract void startDocumentInternal()
                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

endDocument

public final void endDocument()
                       throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endDocumentInternal

protected abstract void endDocumentInternal()
                                     throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

startPrefixMapping

public final void startPrefixMapping(String prefix,
                                     String uri)
Binds the given prefix to the given namespaces.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
See Also:
SimpleNamespaceContext.bindNamespaceUri(String,String)

endPrefixMapping

public final void endPrefixMapping(String prefix)
Removes the binding for the given prefix.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
See Also:
SimpleNamespaceContext.removeBinding(String)

startElement

public final void startElement(String uri,
                               String localName,
                               String qName,
                               org.xml.sax.Attributes atts)
                        throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startElementInternal

protected abstract void startElementInternal(javax.xml.namespace.QName name,
                                             org.xml.sax.Attributes atts,
                                             SimpleNamespaceContext namespaceContext)
                                      throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

endElement

public final void endElement(String uri,
                             String localName,
                             String qName)
                      throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElementInternal

protected abstract void endElementInternal(javax.xml.namespace.QName name,
                                           SimpleNamespaceContext namespaceContext)
                                    throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

characters

public final void characters(char[] ch,
                             int start,
                             int length)
                      throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

charactersInternal

protected abstract void charactersInternal(char[] ch,
                                           int start,
                                           int length)
                                    throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

ignorableWhitespace

public final void ignorableWhitespace(char[] ch,
                                      int start,
                                      int length)
                               throws org.xml.sax.SAXException
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

ignorableWhitespaceInternal

protected abstract void ignorableWhitespaceInternal(char[] ch,
                                                    int start,
                                                    int length)
                                             throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

processingInstruction

public final void processingInstruction(String target,
                                        String data)
                                 throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

processingInstructionInternal

protected abstract void processingInstructionInternal(String target,
                                                      String data)
                                               throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

skippedEntity

public final void skippedEntity(String name)
                         throws org.xml.sax.SAXException
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

skippedEntityInternal

protected abstract void skippedEntityInternal(String name)
                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException


Copyright © 2010. All Rights Reserved.