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.Object
A node in a linked list of prefix to namespace name mappings.
-
-
Field Summary
Fields Modifier and Type Field Description private DOMUtilities.NSMap
next
The next namespace prefix mapping in the list.private int
nextPrefixNumber
The next number to use when generating prefixes.private java.lang.String
ns
The namespace name that the prefix maps to.private java.lang.String
prefix
The prefix to map.
-
Constructor Summary
Constructors Modifier Constructor Description private
NSMap()
Creates a newNSMap
object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DOMUtilities.NSMap
create()
Constructs a new namespace prefix mapping object with the XML and XMLNS namespaces predeclared.DOMUtilities.NSMap
declare(java.lang.String prefix, java.lang.String ns)
Declares a new prefix mapping by returning a newNSMap
object that links to this one.java.lang.String
getNamespace(java.lang.String prefix)
Returns the namespace URI that the specified prefix maps to, ornull
if the prefix has not been declared.java.lang.String
getNewPrefix()
Returns a new, generated namespace prefix.java.lang.String
getPrefixForAttr(java.lang.String ns)
Returns the prefix appropriate for an attribute that maps to specified namespace URI.java.lang.String
getPrefixForElement(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" + number
is 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 newNSMap
object 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, ornull
if 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,null
is 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,null
is returned.
-
-