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

Variable Index

 o local
Local name of the element type or attribute.
 o prefixed
Prefixed name of the element type or attribute.
 o qualified
Qualified name of the element type or attribute.
 o SEPARATOR
The character used to separate the URI from the local name.

Constructor Index

 o NSName()
Construct an empty NSName.
 o NSName(String, String, String)
Construct as NSName from a local name, prefix, and namespace URI.

Method Index

 o getNSName(String, Hashtable)
Given a prefixed name and a Hashtable relating prefixes to namespace URIs, create a new NSName.
 o getPrefix(String)
Get the prefix from a prefixed name.
 o getPrefixedName(String, String)
Construct a prefixed name.
 o getQualifiedName(String, String)
Construct a qualified name.
 o getURI(String)
Get the URI from a qualified name.

Variables

 o 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.

 o local
 public String local
Local name of the element type or attribute.

 o prefixed
 public String prefixed
Prefixed name of the element type or attribute.

 o qualified
 public String qualified
Qualified name of the element type or attribute.

Constructors

 o NSName
 public NSName()
Construct an empty NSName.

 o NSName
 public NSName(String local,
               String prefix,
               String uri)
Construct as NSName from a local name, prefix, and namespace URI.

Methods

 o 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.
 o 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.
 o 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.
 o 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.
 o 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