org.apache.axiom.om.impl.serialize
Class OMXMLReader
java.lang.Object
org.apache.axiom.util.sax.AbstractXMLReader
org.apache.axiom.om.impl.serialize.OMXMLReader
- All Implemented Interfaces:
- XMLReader
public class OMXMLReader
- extends AbstractXMLReader
SAX 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.
Methods inherited from class org.apache.axiom.util.sax.AbstractXMLReader |
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getProperty, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OMXMLReader
public OMXMLReader(OMElement element)
parse
public void parse(InputSource input)
throws IOException,
SAXException
- Throws:
IOException
SAXException
parse
public void parse(String systemId)
throws IOException,
SAXException
- Throws:
IOException
SAXException
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.