|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.icl.saxon.om.Name
An object representing a structured name, containing a Namespace URI,
a Namespace prefix, and a local name.
The equivalence betweem names depends only on the URI and the local name. The prefix is retained for documentary purposes only: it is useful when reconstructing a document to use prefixes that the user is familiar with.
We use the term AbsoluteName to mean the concatenation of the URI and the local name (using circumflex as a separator); and DisplayName to mean the concatenation of the prefix and the local name (using colon as a separator).
This class assumes that any validation on names (e.g. that they contain only one colon) has already been done.
Field Summary | |
static char |
SEPARATOR
|
Constructor Summary | |
Name()
Default constructor for internal use only |
|
Name(java.lang.String name)
Construct a name with no namespace part. |
|
Name(java.lang.String displayName,
ElementInfo nsbase,
boolean useDefault)
Construct a name from its display form, given an ElementInfo that provides the context in which to look up any prefix. |
|
Name(java.lang.String prefix,
java.lang.String uri,
java.lang.String localName)
Construct a name given a prefix, a uri, and a localName. |
Method Summary | |
boolean |
equals(Name other)
Test whether two names are equal. |
java.lang.String |
getAbsoluteName()
Get a representation of the absolute name. |
double |
getDefaultPriority()
Get the default priority when this Name is used on its own as a pattern |
java.lang.String |
getDisplayName()
Get the name in display format. |
short |
getHashCode()
Get a hash code for this name. |
java.lang.String |
getLocalName()
Get the local part of the name (the name after any ":"). |
static java.lang.String |
getLocalPartOfAbsoluteName(java.lang.String absName)
Extract the local part from an absolute name |
java.lang.String |
getPrefix()
Get the prefix of the name, the part before the ":" as used in the original XML |
java.lang.String |
getURI()
Get the URI of the namespace to which the name belongs. |
static java.lang.String |
getURIPartOfAbsoluteName(java.lang.String absName)
Extract the URI part of an absolute name |
boolean |
isNameOf(NodeInfo node)
Determine whether this name matches a given node. |
static boolean |
isNCName(java.lang.String name)
Validate whether a given string constitutes a valid NCName, as defined in XML Namespaces |
static boolean |
isQName(java.lang.String name)
Validate whether a given string constitutes a valid QName, as defined in XML Namespaces |
static Name |
reconstruct(java.lang.String prefix,
java.lang.String uri,
java.lang.String localName)
Reconstruct a name given a prefix, a uri, and a localName. |
java.lang.String |
toString()
Convert name to a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final char SEPARATOR
Constructor Detail |
public Name()
public Name(java.lang.String prefix, java.lang.String uri, java.lang.String localName) throws org.xml.sax.SAXException
prefix
- The name prefix, as written in source XML, the part before the colon. If
there is no prefix, supply the empty string ""uri
- The URI identifying the namespace corresponding to the prefix. If the name
is in the default namespace and the default namespace is unnamed, supply the empty string ""localName
- The part of the name after the colon, or the entire name if there is no
colon.public Name(java.lang.String displayName, ElementInfo nsbase, boolean useDefault) throws org.xml.sax.SAXException
displayName
- The name as it appears in source XML, that is (prefix ':')? localNamensbase
- The ElementInfo defining the context for namespace lookupuseDefault
- True if the default namespace URI should be used when there is no
prefix; false otherwiseorg.xml.sax.SAXException
- if the name is malformed or if the prefix is undeclared.public Name(java.lang.String name)
Method Detail |
public static Name reconstruct(java.lang.String prefix, java.lang.String uri, java.lang.String localName)
prefix
- The name prefix, as written in source XML, the part before the colon. If
there is no prefix, supply the empty string ""uri
- The URI identifying the namespace corresponding to the prefix. If the name
is in the default namespace and the default namespace is unnamed, supply the empty string ""localName
- The part of the name after the colon, or the entire name if there is no
colon.public final java.lang.String getPrefix()
public final java.lang.String getURI()
public final java.lang.String getLocalName()
public final java.lang.String getDisplayName()
public final java.lang.String getAbsoluteName()
public short getHashCode()
public final java.lang.String toString()
toString
in class java.lang.Object
public final boolean equals(Name other)
public static java.lang.String getLocalPartOfAbsoluteName(java.lang.String absName)
public static java.lang.String getURIPartOfAbsoluteName(java.lang.String absName)
public static boolean isNCName(java.lang.String name)
public static boolean isQName(java.lang.String name)
public final boolean isNameOf(NodeInfo node) throws org.xml.sax.SAXException
isNameOf
in interface NameTest
node
- The node to be testedpublic double getDefaultPriority()
getDefaultPriority
in interface NameTest
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |