abstract class AbstractStaxContentHandler
extends java.lang.Object
implements org.xml.sax.ContentHandler
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.Modifier and Type | Field and Description |
---|---|
private SimpleNamespaceContext |
namespaceContext |
private boolean |
namespaceContextChanged |
Constructor and Description |
---|
AbstractStaxContentHandler() |
Modifier and Type | Method and Description |
---|---|
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(java.lang.String uri,
java.lang.String localName,
java.lang.String qName) |
protected abstract void |
endElementInternal(javax.xml.namespace.QName name,
SimpleNamespaceContext namespaceContext) |
void |
endPrefixMapping(java.lang.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(java.lang.String target,
java.lang.String data) |
protected abstract void |
processingInstructionInternal(java.lang.String target,
java.lang.String data) |
void |
skippedEntity(java.lang.String name) |
protected abstract void |
skippedEntityInternal(java.lang.String name) |
void |
startDocument() |
protected abstract void |
startDocumentInternal() |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.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(java.lang.String prefix,
java.lang.String uri)
Binds the given prefix to the given namespaces.
|
protected javax.xml.namespace.QName |
toQName(java.lang.String namespaceUri,
java.lang.String qualifiedName)
Convert a namespace URI and DOM or SAX qualified name to a
QName . |
private SimpleNamespaceContext namespaceContext
private boolean namespaceContextChanged
public final void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected abstract void startDocumentInternal() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected abstract void endDocumentInternal() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
startPrefixMapping
in interface org.xml.sax.ContentHandler
SimpleNamespaceContext.bindNamespaceUri(String,String)
public final void endPrefixMapping(java.lang.String prefix)
endPrefixMapping
in interface org.xml.sax.ContentHandler
SimpleNamespaceContext.removeBinding(String)
public final void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected abstract void startElementInternal(javax.xml.namespace.QName name, org.xml.sax.Attributes atts, SimpleNamespaceContext namespaceContext) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected abstract void endElementInternal(javax.xml.namespace.QName name, SimpleNamespaceContext namespaceContext) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected abstract void charactersInternal(char[] ch, int start, int length) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected abstract void ignorableWhitespaceInternal(char[] ch, int start, int length) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected abstract void processingInstructionInternal(java.lang.String target, java.lang.String data) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public final void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
protected javax.xml.namespace.QName toQName(java.lang.String namespaceUri, java.lang.String qualifiedName)
QName
. The qualified name can have the form
prefix:localname
or localName
.namespaceUri
- the namespace URIqualifiedName
- the qualified nameprotected abstract void skippedEntityInternal(java.lang.String name) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException