Class DOMStreamer.NamespaceNormalizingDOMStreamer

java.lang.Object
org.apache.cocoon.xml.sax.AbstractSAXProducer
org.apache.cocoon.xml.dom.DOMStreamer.NamespaceNormalizingDOMStreamer
Enclosing class:
DOMStreamer

@Deprecated(since="2022-01-27") public static class DOMStreamer.NamespaceNormalizingDOMStreamer extends AbstractSAXProducer
Deprecated.
This API is deprecated, migrate code to the XML APIs provided by the JDK.
Streams a DOM tree to SAX events and normalizes namespace declarations on the way.

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.

  • Constructor Details

    • NamespaceNormalizingDOMStreamer

      public NamespaceNormalizingDOMStreamer()
      Deprecated.
  • Method Details

    • recycle

      public void recycle()
      Deprecated.
      Description copied from class: AbstractSAXProducer
      Recycle the producer by removing references, and resetting handlers to null (empty) implementations.
      Overrides:
      recycle in class AbstractSAXProducer
    • getNamespaceForPrefix

      public String getNamespaceForPrefix(String prefix, Element namespaceContext)
      Deprecated.
      Searches the namespace for a given namespace prefix starting from a given Element.

      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).

      Parameters:
      prefix - the prefix to look for, can be empty or null to find the default namespace
      Returns:
      the namespace, or null if not found.