public class OMXMLReader extends Object implements XMLReader
XMLReader implementation that traverses a given OM tree and invokes the
callback methods on the configured ContentHandler. This can be used to
serialize an Axiom tree to SAX.
Note that this class doesn't support serializing OMDocType
nodes. They will be silently skipped.
This class can also generate SAX events for a subtree. This is the case if the
element passed to the constructor is not the root element of the document. In this
case, care is taken to properly generate startPrefixMapping and
endPrefixMapping events also for namespace mappings declared on the ancestors
of the element.
To understand why this is important, consider the following example:
<root xmlns:ns="urn:ns"><element attr="ns:someThing"/><root>In that case, to correctly interpret the attribute value, the SAX content handler must be aware of the namespace mapping for the ns prefix, even if the serialization starts only at the child element.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
OMXMLReader.AttributesAdapter |
| Constructor and Description |
|---|
OMXMLReader(OMElement element) |
| Modifier and Type | Method and Description |
|---|---|
ContentHandler |
getContentHandler() |
DTDHandler |
getDTDHandler() |
EntityResolver |
getEntityResolver() |
ErrorHandler |
getErrorHandler() |
boolean |
getFeature(String name) |
Object |
getProperty(String name) |
void |
parse(InputSource input) |
void |
parse(String systemId) |
void |
setContentHandler(ContentHandler contentHandler) |
void |
setDTDHandler(DTDHandler dtdHandler) |
void |
setEntityResolver(EntityResolver entityResolver) |
void |
setErrorHandler(ErrorHandler errorHandler) |
void |
setFeature(String name,
boolean value) |
void |
setProperty(String name,
Object value) |
public OMXMLReader(OMElement element)
public ContentHandler getContentHandler()
getContentHandler in interface XMLReaderpublic void setContentHandler(ContentHandler contentHandler)
setContentHandler in interface XMLReaderpublic DTDHandler getDTDHandler()
getDTDHandler in interface XMLReaderpublic void setDTDHandler(DTDHandler dtdHandler)
setDTDHandler in interface XMLReaderpublic EntityResolver getEntityResolver()
getEntityResolver in interface XMLReaderpublic void setEntityResolver(EntityResolver entityResolver)
setEntityResolver in interface XMLReaderpublic ErrorHandler getErrorHandler()
getErrorHandler in interface XMLReaderpublic void setErrorHandler(ErrorHandler errorHandler)
setErrorHandler in interface XMLReaderpublic boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getFeature in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
setFeature in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic void parse(InputSource input) throws IOException, SAXException
parse in interface XMLReaderIOExceptionSAXExceptionpublic void parse(String systemId) throws IOException, SAXException
parse in interface XMLReaderIOExceptionSAXExceptionCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.