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 only supports ContentHandler
and LexicalHandler
.
DTDHandler
and DeclHandler
are not supported.
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(OMContainer root) |
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(OMContainer root)
public void parse(InputSource input) throws IOException, SAXException
IOException
SAXException
public void parse(String systemId) throws IOException, SAXException
IOException
SAXException
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.