Package org.apache.batik.dom.util
Class DOMUtilities.NSMap
- java.lang.Object
-
- org.apache.batik.dom.util.DOMUtilities.NSMap
-
- Enclosing class:
- DOMUtilities
private static final class DOMUtilities.NSMap extends java.lang.ObjectA node in a linked list of prefix to namespace name mappings.
-
-
Field Summary
Fields Modifier and Type Field Description private DOMUtilities.NSMapnextThe next namespace prefix mapping in the list.private intnextPrefixNumberThe next number to use when generating prefixes.private java.lang.StringnsThe namespace name that the prefix maps to.private java.lang.StringprefixThe prefix to map.
-
Constructor Summary
Constructors Modifier Constructor Description privateNSMap()Creates a newNSMapobject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DOMUtilities.NSMapcreate()Constructs a new namespace prefix mapping object with the XML and XMLNS namespaces predeclared.DOMUtilities.NSMapdeclare(java.lang.String prefix, java.lang.String ns)Declares a new prefix mapping by returning a newNSMapobject that links to this one.java.lang.StringgetNamespace(java.lang.String prefix)Returns the namespace URI that the specified prefix maps to, ornullif the prefix has not been declared.java.lang.StringgetNewPrefix()Returns a new, generated namespace prefix.java.lang.StringgetPrefixForAttr(java.lang.String ns)Returns the prefix appropriate for an attribute that maps to specified namespace URI.java.lang.StringgetPrefixForElement(java.lang.String ns)Returns the prefix appropriate for an element that maps to specified namespace URI.
-
-
-
Field Detail
-
prefix
private java.lang.String prefix
The prefix to map.
-
ns
private java.lang.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" + numberis generated when serializing a node whose namespace URI does not correspond to a prefix in scope.
-
-
Method Detail
-
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(java.lang.String prefix, java.lang.String ns)
Declares a new prefix mapping by returning a newNSMapobject that links to this one.
-
getNewPrefix
public java.lang.String getNewPrefix()
Returns a new, generated namespace prefix.
-
getNamespace
public java.lang.String getNamespace(java.lang.String prefix)
Returns the namespace URI that the specified prefix maps to, ornullif the prefix has not been declared.
-
getPrefixForElement
public java.lang.String getPrefixForElement(java.lang.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,nullis returned.
-
getPrefixForAttr
public java.lang.String getPrefixForAttr(java.lang.String ns)
Returns the prefix appropriate for an attribute that maps to specified namespace URI. If there is no appropriate prefix,nullis returned.
-
-