public class OMXMLReader extends AbstractXMLReader
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 |
contentHandler, dtdHandler, entityResolver, errorHandler, lexicalHandler, namespacePrefixes, namespaces
Constructor and Description |
---|
OMXMLReader(OMElement element) |
Modifier and Type | Method and Description |
---|---|
void |
parse(InputSource input) |
void |
parse(String systemId) |
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getProperty, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty
public OMXMLReader(OMElement element)
public void parse(InputSource input) throws IOException, SAXException
IOException
SAXException
public void parse(String systemId) throws IOException, SAXException
IOException
SAXException
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.