Package com.globalmentor.xml
Class XMLNamespacePrefixManager
- java.lang.Object
-
- com.globalmentor.xml.XMLNamespacePrefixManager
-
public class XMLNamespacePrefixManager extends java.lang.Object
Deprecated.Manages XML namespaces and prefixes for serialization. This class is initialized with a default set of known namespace prefix mappings. Mapping prefixes to thenull
namespace or to thenull
prefix is allowed.This class is not thread safe.
- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description XMLNamespacePrefixManager()
Deprecated.Default constructor that is initialized with a default set of namespace prefix mappings.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getNamespacePrefix(java.lang.String namespace)
Deprecated.Retrieves the prefix to use for the given namespace.java.lang.String
getNamespacePrefix(java.lang.String namespaceURI, boolean generatePrefix)
Deprecated.Retrieves the prefix to use for the given namespace.java.lang.Iterable<java.lang.String>
getRegisteredNamespaces()
Deprecated.void
registerNamespacePrefix(java.lang.String namespace, java.lang.String prefix)
Deprecated.Registers the given XML serialization prefix to be used with the given namespace.void
unregisterNamespacePrefix(java.lang.String namespace)
Deprecated.Unregisters the XML serialization prefix for the given namespace.
-
-
-
Method Detail
-
registerNamespacePrefix
public void registerNamespacePrefix(java.lang.String namespace, java.lang.String prefix)
Deprecated.Registers the given XML serialization prefix to be used with the given namespace. If a prefix is already registered with the given namespace, it is replaced with this prefix.- Parameters:
namespace
- The namespace to register.prefix
- The XML serialization prefix to use with the given namespace.
-
unregisterNamespacePrefix
public void unregisterNamespacePrefix(java.lang.String namespace)
Deprecated.Unregisters the XML serialization prefix for the given namespace. If no prefix is registered for the given namespace, no action occurs.- Parameters:
namespace
- The namespace to unregister.
-
getRegisteredNamespaces
public java.lang.Iterable<java.lang.String> getRegisteredNamespaces()
Deprecated.- Returns:
- An iterable to the namespaces for which prefixes are registered.
-
getNamespacePrefix
public java.lang.String getNamespacePrefix(java.lang.String namespace)
Deprecated.Retrieves the prefix to use for the given namespace. If a namespace is unrecognized, a new one will be created and stored for future use.- Parameters:
namespace
- The namespace for which a prefix should be returned- Returns:
- A prefix for use with the given namespace.
-
getNamespacePrefix
public java.lang.String getNamespacePrefix(java.lang.String namespaceURI, boolean generatePrefix)
Deprecated.Retrieves the prefix to use for the given namespace.To accommodate vocabularies with different namespace-prefix mapping rules (such as RDF and and XML Schema) which result in different namespace representations, if the namespace URI ends in a fragment separator ('#') and no prefix is found, an attempt is made to look up a prefix using the namespace URI without that trailing fragment separator character.
If a namespace is unrecognized (i.e. no prefix, including the
null
prefix, has been registered with the given namespace), a new one will optionally be created and stored in the map for future use.The Java package name of any Java URIs ending in '.' will be used as the namespace prefix if possible, if none exists already.
- Parameters:
namespaceURI
- The namespace for which a prefix should be returnedgeneratePrefix
-true
if a prefix should be generated if no prefix is assigned to the given namespace URI.- Returns:
- A prefix for use with the given namespace, or
null
if no prefix is assigned to the given namespace URI and generatePrefix isfalse
.
-
-