com.objsys.asn1j.runtime
Class Asn1XmlNamespaceCtxt

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1XmlNamespaceCtxt

public class Asn1XmlNamespaceCtxt
extends java.lang.Object

Represents a mapping between namespaces and prefixes. A prefix may map only to a single namespace. A namespace may be bound to multiple prefixes. The default namespace is mapped by DEFAULT_NS_PREFIX. By default, the default namespace is NULL_NS_URI.


Field Summary
static java.lang.String DEFAULT_NS_PREFIX
           
static java.lang.String NULL_NS_URI
           
 
Constructor Summary
Asn1XmlNamespaceCtxt()
           
 
Method Summary
 java.lang.String addNamespace(java.lang.String namespaceURI, java.lang.String prefix)
          Add (or replace) a namespace mapping.
 java.lang.String addUniquePrefix(java.lang.String namespaceURI)
          Map a unique prefix for the given namespace.
 java.lang.String getExistingPrefix(java.lang.String namespaceURI)
          Return a prefix for the given namespace URI.
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Return the namespace URI that the given prefix is mapped to.
 java.lang.String getPrefix(java.lang.String namespaceURI)
          Return a prefix for the given namespace URI.
 boolean isDefaultNamespaceURI(java.lang.String namespaceURI)
          Return true if the given namespace is currently the default namespace (ie, DEFAULT_NS_PREFIX is mapped to this URI)
 java.util.Set prefixes()
          Return an unmodifiable Set of all mapped prefixes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NS_PREFIX

public static final java.lang.String DEFAULT_NS_PREFIX
See Also:
Constant Field Values

NULL_NS_URI

public static final java.lang.String NULL_NS_URI
See Also:
Constant Field Values
Constructor Detail

Asn1XmlNamespaceCtxt

public Asn1XmlNamespaceCtxt()
Method Detail

addNamespace

public java.lang.String addNamespace(java.lang.String namespaceURI,
                                     java.lang.String prefix)
Add (or replace) a namespace mapping. If prefix was previously mapped, the previously mapped URI is returned. Otherwise, NULL_NS_URI is returned.

Parameters:
namespaceURI -
prefix -

addUniquePrefix

public java.lang.String addUniquePrefix(java.lang.String namespaceURI)
Map a unique prefix for the given namespace.

Returns:
the unique prefix that was generated and mapped to the namespace

getExistingPrefix

public java.lang.String getExistingPrefix(java.lang.String namespaceURI)
Return a prefix for the given namespace URI. If the DEFAULT_NS_PREFIX is mapped to the URI, it will be returned. Otherwise, if one or more other prefixes are mapped to the URI, one of these will be returned. Finally, if no prefix at all is mapped to the URI, null is returned.

Parameters:
namespaceURI -
Returns:

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Return the namespace URI that the given prefix is mapped to. Return NULL_NS_URI if it is not mapped to any URI

Parameters:
prefix -

getPrefix

public java.lang.String getPrefix(java.lang.String namespaceURI)
Return a prefix for the given namespace URI. If one or more prefixes other than DEFAULT_NS_PREFIX is mapped to the URI, one of these will be returned. Otherwise, a generated prefix will be automatically mapped to the URI and returned.

Parameters:
namespaceURI -
Returns:

isDefaultNamespaceURI

public boolean isDefaultNamespaceURI(java.lang.String namespaceURI)
Return true if the given namespace is currently the default namespace (ie, DEFAULT_NS_PREFIX is mapped to this URI)

Parameters:
namespaceURI -
Returns:

prefixes

public java.util.Set prefixes()
Return an unmodifiable Set of all mapped prefixes

Returns: