public static class DOMStreamer.NamespaceNormalizingDOMStreamer extends AbstractSAXProducer
The code in this class is based on the org.apache.xml.utils.TreeWalker class from Xalan, though it differs in some important ways.
This class will automatically fix up ("normalize") namespace declarations while streaming to SAX. The original DOM-tree is not modified. The algorithm used is described in an appendix of the DOM Level 3 spec.
This class will NOT check the correctness of namespaces, e.g. it will not check that the "xml" prefix is not misused etc.
Modifier and Type | Class and Description |
---|---|
static class |
DOMStreamer.NamespaceNormalizingDOMStreamer.ElementInfo |
Constructor and Description |
---|
NamespaceNormalizingDOMStreamer() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getNamespaceForPrefix(java.lang.String prefix,
org.w3c.dom.Element namespaceContext)
Searches the namespace for a given namespace prefix starting from a
given Element.
|
void |
recycle()
Recycle the producer by removing references, and resetting handlers to
null (empty) implementations.
|
setContentHandler
public void recycle()
AbstractSAXProducer
recycle
in class AbstractSAXProducer
public java.lang.String getNamespaceForPrefix(java.lang.String prefix, org.w3c.dom.Element namespaceContext)
Note that this resolves the prefix in the orginal DOM-tree, not in
the DOMStreamer.NamespaceNormalizingDOMStreamer.ElementInfo
objects. This is used to resolve prefixes
of elements or attributes created with createElement or setAttribute
instead of createElementNS or setAttributeNS.
The code in this method is largely based on org.apache.xml.utils.DOMHelper.getNamespaceForPrefix() (from Xalan).
prefix
- the prefix to look for, can be empty or null to find the
default namespace"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"