org.apache.xml.utils
Class QName
- Serializable
Class to represent a qualified name: "The name of an internal XSLT object,
specifically a named template (see [7 Named Templates]), a mode (see [6.7 Modes]),
an attribute set (see [8.1.4 Named Attribute Sets]), a key (see [14.2 Keys]),
a locale (see [14.3 Number Formatting]), a variable or a parameter (see
[12 Variables and Parameters]) is specified as a QName. If it has a prefix,
then the prefix is expanded into a URI reference using the namespace declarations
in effect on the attribute in which the name occurs. The expanded name
consisting of the local part of the name and the possibly null URI reference
is used as the name of the object. The default namespace is not used for
unprefixed names."
QName() - Constructs an empty QName.
|
QName(String localName) - Construct a QName from a string, without namespace resolution.
|
QName(String qname, Element namespaceContext, PrefixResolver resolver) - Construct a QName from a string, resolving the prefix
using the given namespace context and prefix resolver.
|
QName(String qname, Element namespaceContext, PrefixResolver resolver, boolean validate) - Construct a QName from a string, resolving the prefix
using the given namespace context and prefix resolver.
|
QName(String qname, Stack namespaces) - Construct a QName from a string, resolving the prefix
using the given namespace stack.
|
QName(String qname, Stack namespaces, boolean validate) - Construct a QName from a string, resolving the prefix
using the given namespace stack.
|
QName(String namespaceURI, String localName) - Constructs a new QName with the specified namespace URI and
local name.
|
QName(String namespaceURI, String prefix, String localName) - Constructs a new QName with the specified namespace URI, prefix
and local name.
|
QName(String namespaceURI, String prefix, String localName, boolean validate) - Constructs a new QName with the specified namespace URI, prefix
and local name.
|
QName(String namespaceURI, String localName, boolean validate) - Constructs a new QName with the specified namespace URI and
local name.
|
QName(String localName, boolean validate) - Construct a QName from a string, without namespace resolution.
|
QName(String qname, PrefixResolver resolver) - Construct a QName from a string, resolving the prefix
using the given namespace stack.
|
QName(String qname, PrefixResolver resolver, boolean validate) - Construct a QName from a string, resolving the prefix
using the given namespace stack.
|
boolean | equals(Object object) - Override equals and agree that we're equal if
the passed object is a QName and it matches
the name of the arg.
|
boolean | equals(String ns, String localPart) - Override equals and agree that we're equal if
the passed object is a string and it matches
the name of the arg.
|
String | getLocalName() - Returns the local part of the qualified name.
|
String | getLocalPart() - Get the local part of the qualified name.
|
static String | getLocalPart(String qname) - Returns the local name of the given node.
|
String | getNamespace() - Get the namespace of the qualified name.
|
String | getNamespaceURI() - Returns the namespace URI.
|
String | getPrefix() - Returns the namespace prefix.
|
static String | getPrefixFromXMLNSDecl(String attRawName) - This function tells if a raw attribute name is a
xmlns attribute.
|
static String | getPrefixPart(String qname) - Returns the local name of the given node.
|
static QName | getQNameFromString(String name) - Given a string, create and return a QName object
|
int | hashCode() - Return the cached hashcode of the qualified name.
|
static boolean | isXMLNSDecl(String attRawName) - This function tells if a raw attribute name is a
xmlns attribute.
|
String | toNamespacedString() - Return the string representation of the qualified name using the
the '{ns}foo' notation.
|
String | toString() - Return the string representation of the qualified name, using the
prefix if available, or the '{ns}foo' notation if not.
|
S_XMLNAMESPACEURI
public static final String S_XMLNAMESPACEURI
The XML namespace.
QName
public QName()
Constructs an empty QName.
20001019: Try making this public, to support Serializable? -- JKESS
QName
public QName(String localName)
Construct a QName from a string, without namespace resolution. Good
for a few odd cases.
localName
- Local part of qualified name
QName
public QName(String qname,
Element namespaceContext,
PrefixResolver resolver)
Construct a QName from a string, resolving the prefix
using the given namespace context and prefix resolver.
The default namespace is not resolved.
qname
- Qualified name to resolvenamespaceContext
- Namespace Context to useresolver
- Prefix resolver for this context
QName
public QName(String qname,
Element namespaceContext,
PrefixResolver resolver,
boolean validate)
Construct a QName from a string, resolving the prefix
using the given namespace context and prefix resolver.
The default namespace is not resolved.
qname
- Qualified name to resolvenamespaceContext
- Namespace Context to useresolver
- Prefix resolver for this contextvalidate
- If true the new QName will be validated and an IllegalArgumentException will
be thrown if it is invalid.
QName
public QName(String qname,
Stack namespaces)
Construct a QName from a string, resolving the prefix
using the given namespace stack. The default namespace is
not resolved.
qname
- Qualified name to resolvenamespaces
- Namespace stack to use to resolve namespace
QName
public QName(String qname,
Stack namespaces,
boolean validate)
Construct a QName from a string, resolving the prefix
using the given namespace stack. The default namespace is
not resolved.
qname
- Qualified name to resolvenamespaces
- Namespace stack to use to resolve namespacevalidate
- If true the new QName will be validated and an IllegalArgumentException will
be thrown if it is invalid.
QName
public QName(String namespaceURI,
String localName)
Constructs a new QName with the specified namespace URI and
local name.
namespaceURI
- The namespace URI if known, or nulllocalName
- The local name
QName
public QName(String namespaceURI,
String prefix,
String localName)
Constructs a new QName with the specified namespace URI, prefix
and local name.
namespaceURI
- The namespace URI if known, or nullprefix
- The namespace prefix is known, or nulllocalName
- The local name
QName
public QName(String namespaceURI,
String prefix,
String localName,
boolean validate)
Constructs a new QName with the specified namespace URI, prefix
and local name.
namespaceURI
- The namespace URI if known, or nullprefix
- The namespace prefix is known, or nulllocalName
- The local namevalidate
- If true the new QName will be validated and an IllegalArgumentException will
be thrown if it is invalid.
QName
public QName(String namespaceURI,
String localName,
boolean validate)
Constructs a new QName with the specified namespace URI and
local name.
namespaceURI
- The namespace URI if known, or nulllocalName
- The local namevalidate
- If true the new QName will be validated and an IllegalArgumentException will
be thrown if it is invalid.
QName
public QName(String localName,
boolean validate)
Construct a QName from a string, without namespace resolution. Good
for a few odd cases.
localName
- Local part of qualified namevalidate
- If true the new QName will be validated and an IllegalArgumentException will
be thrown if it is invalid.
QName
public QName(String qname,
PrefixResolver resolver)
Construct a QName from a string, resolving the prefix
using the given namespace stack. The default namespace is
not resolved.
qname
- Qualified name to resolveresolver
- Prefix resolver for this context
QName
public QName(String qname,
PrefixResolver resolver,
boolean validate)
Construct a QName from a string, resolving the prefix
using the given namespace stack. The default namespace is
not resolved.
qname
- Qualified name to resolveresolver
- Prefix resolver for this contextvalidate
- If true the new QName will be validated and an IllegalArgumentException will
be thrown if it is invalid.
equals
public boolean equals(Object object)
Override equals and agree that we're equal if
the passed object is a QName and it matches
the name of the arg.
- True if the qualified names are equal
equals
public boolean equals(String ns,
String localPart)
Override equals and agree that we're equal if
the passed object is a string and it matches
the name of the arg.
ns
- Namespace URI to compare tolocalPart
- Local part of qualified name to compare to
- True if the local name and uri match
getLocalName
public String getLocalName()
Returns the local part of the qualified name.
- The local part of the qualified name
getLocalPart
public String getLocalPart()
Get the local part of the qualified name.
- the local part of the qualified name
getLocalPart
public static String getLocalPart(String qname)
Returns the local name of the given node.
- Local part of the name if prefixed, or the given name if not
getNamespace
public String getNamespace()
Get the namespace of the qualified name.
- the namespace URI of the qualified name
getNamespaceURI
public String getNamespaceURI()
Returns the namespace URI. Returns null if the namespace URI
is not known.
- The namespace URI, or null
getPrefix
public String getPrefix()
Returns the namespace prefix. Returns null if the namespace
prefix is not known.
- The namespace prefix, or null
getPrefixFromXMLNSDecl
public static String getPrefixFromXMLNSDecl(String attRawName)
This function tells if a raw attribute name is a
xmlns attribute.
attRawName
- Raw name of attribute
getPrefixPart
public static String getPrefixPart(String qname)
Returns the local name of the given node.
- Prefix of name or empty string if none there
getQNameFromString
public static QName getQNameFromString(String name)
Given a string, create and return a QName object
name
- String to use to create QName
hashCode
public int hashCode()
Return the cached hashcode of the qualified name.
- the cached hashcode of the qualified name
isXMLNSDecl
public static boolean isXMLNSDecl(String attRawName)
This function tells if a raw attribute name is a
xmlns attribute.
attRawName
- Raw name of attribute
- True if the attribute starts with or is equal to xmlns
toNamespacedString
public String toNamespacedString()
Return the string representation of the qualified name using the
the '{ns}foo' notation. Performs
string concatenation, so beware of performance issues.
- the string representation of the namespace
toString
public String toString()
Return the string representation of the qualified name, using the
prefix if available, or the '{ns}foo' notation if not. Performs
string concatenation, so beware of performance issues.
- the string representation of the namespace
Copyright B) 2004 Apache XML Project. All Rights Reserved.