net.sf.saxon.om
Class Name

java.lang.Object
  extended bynet.sf.saxon.om.Name

public abstract class Name
extends java.lang.Object

This class exists to contain some static methods for validating the syntax of names.


Method Summary
static java.lang.String getPrefix(java.lang.String qname)
          Extract the prefix from a QName.
static java.lang.String[] getQNameParts(java.lang.CharSequence qname)
          Validate a QName, and return the prefix and local name.
static boolean isQName(java.lang.String name)
          Validate whether a given string constitutes a valid QName, as defined in XML Namespaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isQName

public static final boolean isQName(java.lang.String name)
Validate whether a given string constitutes a valid QName, as defined in XML Namespaces. Note that this does not test whether the prefix is actually declared.

Parameters:
name - the name to be tested
Returns:
true if the name is a lexically-valid QName

getPrefix

public static final java.lang.String getPrefix(java.lang.String qname)
Extract the prefix from a QName. Note, the QName is assumed to be valid.

Parameters:
qname - The lexical QName whose prefix is required
Returns:
the prefix, that is the part before the colon. Returns an empty string if there is no prefix

getQNameParts

public static final java.lang.String[] getQNameParts(java.lang.CharSequence qname)
                                              throws QNameException
Validate a QName, and return the prefix and local name.

Parameters:
qname - the lexical QName whose parts are required
Returns:
an array of two strings, the prefix and the local name. The first item is a zero-length string if there is no prefix.
Throws:
QNameException - if not a valid QName.