public class QName extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected String |
_localName
The local name.
|
protected String |
_namespaceURI
The namespace URI.
|
protected String |
_prefix
The namespace prefix.
|
static String |
S_XMLNAMESPACEURI
The XML namespace.
|
Constructor and Description |
---|
QName()
Constructs an empty QName.
|
QName(String localName)
Construct a QName from a string, without namespace resolution.
|
QName(String localName,
boolean validate)
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,
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.
|
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 localName,
boolean validate)
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected String _localName
protected String _namespaceURI
protected String _prefix
public static final String S_XMLNAMESPACEURI
public QName()
public QName(String namespaceURI, String localName)
namespaceURI
- The namespace URI if known, or nulllocalName
- The local namepublic QName(String namespaceURI, String localName, boolean validate)
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.public QName(String namespaceURI, String prefix, String localName)
namespaceURI
- The namespace URI if known, or nullprefix
- The namespace prefix is known, or nulllocalName
- The local namepublic QName(String namespaceURI, String prefix, String localName, boolean validate)
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.public QName(String localName)
localName
- Local part of qualified namepublic QName(String localName, boolean validate)
localName
- Local part of qualified namevalidate
- If true the new QName will be validated and an IllegalArgumentException will
be thrown if it is invalid.public QName(String qname, Stack namespaces)
qname
- Qualified name to resolvenamespaces
- Namespace stack to use to resolve namespacepublic QName(String qname, Stack namespaces, boolean validate)
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.public QName(String qname, Element namespaceContext, PrefixResolver resolver)
qname
- Qualified name to resolvenamespaceContext
- Namespace Context to useresolver
- Prefix resolver for this contextpublic QName(String qname, Element namespaceContext, PrefixResolver resolver, boolean validate)
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.public QName(String qname, PrefixResolver resolver)
qname
- Qualified name to resolveresolver
- Prefix resolver for this contextpublic QName(String qname, PrefixResolver resolver, boolean validate)
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.public String getNamespaceURI()
public String getPrefix()
public String getLocalName()
public String toString()
public String toNamespacedString()
public String getNamespace()
public String getLocalPart()
public int hashCode()
public boolean equals(String ns, String localPart)
ns
- Namespace URI to compare tolocalPart
- Local part of qualified name to compare topublic boolean equals(Object object)
public static QName getQNameFromString(String name)
name
- String to use to create QNamepublic static boolean isXMLNSDecl(String attRawName)
attRawName
- Raw name of attributepublic static String getPrefixFromXMLNSDecl(String attRawName)
attRawName
- Raw name of attributepublic static String getLocalPart(String qname)
qname
- Input nameCopyright © 2016 JBoss by Red Hat. All rights reserved.