All Packages Class Hierarchy This Package Previous Next Index
Class de.tudarmstadt.ito.utils.NSName
java.lang.Object
|
+----de.tudarmstadt.ito.utils.NSName
- public class NSName
- extends Object
Contains an element type or attribute name in local, prefixed, and
namespace-URI qualified forms.
The local form of an element type or attribute name is the unprefixed
name. The prefixed form is the prefixed (with colon) form. The qualified
form is the namespace URI plus a caret (^) plus the local name. If the
element type or attribute does not belong to a namespace, then all three
forms are the same. For example:
Local name: "element1"
Prefixed name: "foo:element1"
Qualified name: "http://foo^element1"
Local name: "element2"
Prefixed name: "element2"
Qualified name: "element2"
- Version:
- 1.01
- Author:
- Ronald Bourret, Technical University of Darmstadt
-
local
- Local name of the element type or attribute.
-
prefixed
- Prefixed name of the element type or attribute.
-
qualified
- Qualified name of the element type or attribute.
-
SEPARATOR
- The character used to separate the URI from the local name.
-
NSName()
- Construct an empty NSName.
-
NSName(String, String, String)
- Construct as NSName from a local name, prefix, and namespace URI.
-
getNSName(String, Hashtable)
- Given a prefixed name and a Hashtable relating prefixes to
namespace URIs, create a new NSName.
-
getPrefix(String)
- Get the prefix from a prefixed name.
-
getPrefixedName(String, String)
- Construct a prefixed name.
-
getQualifiedName(String, String)
- Construct a qualified name.
-
getURI(String)
- Get the URI from a qualified name.
SEPARATOR
public static String SEPARATOR
- The character used to separate the URI from the local name. Following the
convention of John Cowan's SAX namespace filter, a caret (^) is used
because it is neither a valid URI character nor a valid XML name
character.
local
public String local
- Local name of the element type or attribute.
prefixed
public String prefixed
- Prefixed name of the element type or attribute.
qualified
public String qualified
- Qualified name of the element type or attribute.
NSName
public NSName()
- Construct an empty NSName.
NSName
public NSName(String local,
String prefix,
String uri)
- Construct as NSName from a local name, prefix, and namespace URI.
getQualifiedName
public static String getQualifiedName(String local,
String uri)
- Construct a qualified name. Returns the local name if the URI is
null or zero-length.
- Parameters:
- local - The local name.
- uri - The namespace URI.
getPrefixedName
public static String getPrefixedName(String local,
String prefix)
- Construct a prefixed name. Returns the local name if the URI is
null or zero-length.
- Parameters:
- local - The local name.
- uri - The namespace prefix.
getNSName
public static NSName getNSName(String prefixedName,
Hashtable namespaceURIs)
- Given a prefixed name and a Hashtable relating prefixes to
namespace URIs, create a new NSName.
If the name is not prefixed, or if the Hashtable parameter is null,
then the local, prefixed, and qualified names in the returned NSName
are all set to the prefixedName parameter.
- Parameters:
- prefixedName - The prefixed name. Not required to contain a prefix.
- namespaceURIs - The Hashtable containing prefixes as keys and
namespace URIs as values. May be null.
- Returns:
- The new NSName.
- Throws: IllegalArgumentException
- Thrown if the prefixed name contains
more than one colon or the Hashtable does not contain the prefix as a
key.
getPrefix
public static String getPrefix(String prefixedName)
- Get the prefix from a prefixed name.
- Parameters:
- prefixedName - The prefixed name.
- Returns:
- The prefix or null if there is no prefix. Note that null is
also returned if the prefix is xmlns, which we don't treat as a prefix
since (by definition) it is not associated with any namespace.
getURI
public static String getURI(String qualifiedName)
- Get the URI from a qualified name.
- Parameters:
- prefixedName - The qualified name.
- Returns:
- The URI or null if there is no URI.
All Packages Class Hierarchy This Package Previous Next Index