Class DOMUtilities.NSMap

java.lang.Object
org.apache.batik.dom.util.DOMUtilities.NSMap
Enclosing class:
DOMUtilities

private static final class DOMUtilities.NSMap extends Object
A node in a linked list of prefix to namespace name mappings.
  • Field Details

    • prefix

      private String prefix
      The prefix to map.
    • ns

      private String ns
      The namespace name that the prefix maps to. The empty string is used to represent no namespace.
    • next

      private DOMUtilities.NSMap next
      The next namespace prefix mapping in the list.
    • nextPrefixNumber

      private int nextPrefixNumber
      The next number to use when generating prefixes. A prefix of the form "a" + number is generated when serializing a node whose namespace URI does not correspond to a prefix in scope.
  • Constructor Details

    • NSMap

      private NSMap()
      Creates a new NSMap object.
  • Method Details

    • create

      public static DOMUtilities.NSMap create()
      Constructs a new namespace prefix mapping object with the XML and XMLNS namespaces predeclared.
    • declare

      public DOMUtilities.NSMap declare(String prefix, String ns)
      Declares a new prefix mapping by returning a new NSMap object that links to this one.
    • getNewPrefix

      public String getNewPrefix()
      Returns a new, generated namespace prefix.
    • getNamespace

      public String getNamespace(String prefix)
      Returns the namespace URI that the specified prefix maps to, or null if the prefix has not been declared.
    • getPrefixForElement

      public String getPrefixForElement(String ns)
      Returns the prefix appropriate for an element that maps to specified namespace URI. If the specified namespace is the default namespace (i.e., it has an empty string prefix mapping to it), then the empty string is returned. If there is no appropriate prefix, null is returned.
    • getPrefixForAttr

      public String getPrefixForAttr(String ns)
      Returns the prefix appropriate for an attribute that maps to specified namespace URI. If there is no appropriate prefix, null is returned.