Top Description Fields Constructors Methods
org.dom4j

public Class QName

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.regex.Pattern, org.dom4j.tree.QNameCache, org.dom4j.util.SingletonStrategy

QName represents a qualified name value of an XML element or attribute. It consists of a local name and a Namespaceinstance. This object is immutable.
Authors
James Strachan , Filip Jirsák

Field Summary

Modifier and TypeField and Description
private DocumentFactory
documentFactory

The document factory used for this QName if specified or null

private int
hashCode

A cached version of the hashcode for efficiency

private String
name

The local name of the element or attribute

private static final String
NAME_CHAR

NameChar without colon.

private static final String
NAME_START_CHAR

NameStartChar without colon.

private transient Namespace
namespace

The Namespace of this element or attribute

private static final String
NCNAME

NCName

NCName		::=	NCNameStartChar NCNameChar*	(An XML Name, minus the ":")
NCNameChar	::=	NameChar -':'
NCNameStartChar	::=	NameStartChar -':'
private String
qualifiedName

The qualified name of the element or attribute

private static final Pattern
RE_NAME

Regular expression for Name (with colon).

private static final Pattern
RE_NCNAME

Regular expression for NCName.

private static final Pattern
RE_QNAME

Regular expression for QName.

private static SingletonStrategy<QNameCache>
singleton

The Singleton instance

Constructor Summary

AccessConstructor and Description
public
QName(String name)

public
QName(String name, Namespace namespace)

public
QName(String name, Namespace namespace, String qualifiedName)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static QName
get(String name)

public static QName
get(String name, Namespace namespace)

public static QName
get(String name, String prefix, String uri)

public static QName
get(String qualifiedName, String uri)

public static QName
get(String localName, Namespace namespace, String qualifiedName)

private static QNameCache
public DocumentFactory

Returns:

the factory that should be used for Elements of this QName
getDocumentFactory
()

DOCUMENT ME!

public String

Returns:

the local name
getName
()

DOCUMENT ME!

public Namespace

Returns:

the namespace of this QName
getNamespace
()

DOCUMENT ME!

public String

Returns:

the namespace URI of this QName
getNamespacePrefix
()

DOCUMENT ME!

public String

Returns:

the namespace URI of this QName
getNamespaceURI
()

DOCUMENT ME!

public String

Returns:

the qualified name in the format prefix:localName
getQualifiedName
()

DOCUMENT ME!

public int

Returns:

the hash code based on the qualified name and the URI of the namespace.
hashCode
()

Overrides java.lang.Object.hashCode.

DOCUMENT ME!
private void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private static void
protected static void
private static void
private void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

documentFactoryback to summary
private DocumentFactory documentFactory

The document factory used for this QName if specified or null

hashCodeback to summary
private int hashCode

A cached version of the hashcode for efficiency

nameback to summary
private String name

The local name of the element or attribute

NAME_CHARback to summary
private static final String NAME_CHAR

NameChar without colon.

NameChar	::=	NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
See Also
XML 1.0 – 2.3 Common Syntactic Constructs, XML 1.1 – 2.3 Common Syntactic Constructs
NAME_START_CHARback to summary
private static final String NAME_START_CHAR

NameStartChar without colon.

NameStartChar	::=	":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
See Also
XML 1.0 – 2.3 Common Syntactic Constructs, XML 1.1 – 2.3 Common Syntactic Constructs
namespaceback to summary
private transient Namespace namespace

The Namespace of this element or attribute

NCNAMEback to summary
private static final String NCNAME

NCName

NCName		::=	NCNameStartChar NCNameChar*	(An XML Name, minus the ":")
NCNameChar	::=	NameChar -':'
NCNameStartChar	::=	NameStartChar -':'
See Also
Namespaces in XML 1.0 – 4 Qualified Names, Namespaces in XML 1.1 – 4 Qualified Names
qualifiedNameback to summary
private String qualifiedName

The qualified name of the element or attribute

RE_NAMEback to summary
private static final Pattern RE_NAME

Regular expression for Name (with colon).

Name	::=	NameStartChar (NameChar)*
See Also
XML 1.0 – 2.3 Common Syntactic Constructs, XML 1.1 – 2.3 Common Syntactic Constructs
RE_NCNAMEback to summary
private static final Pattern RE_NCNAME

Regular expression for NCName.

NCName		::=	NCNameStartChar NCNameChar*	(An XML Name, minus the ":")
NCNameChar	::=	NameChar -':'
NCNameStartChar	::=	NameStartChar -':'
See Also
Namespaces in XML 1.0 – 4 Qualified Names, Namespaces in XML 1.1 – 4 Qualified Names
RE_QNAMEback to summary
private static final Pattern RE_QNAME

Regular expression for QName.

QName		::=	PrefixedName | UnprefixedName
PrefixedName	::=	Prefix ':' LocalPart
UnprefixedName	::=	LocalPart
Prefix		::=	NCName
LocalPart	::=	NCName
See Also
Namespaces in XML 1.0 – 4 Qualified Names, Namespaces in XML 1.1 – 4 Qualified Names
singletonback to summary
private static SingletonStrategy<QNameCache> singleton

The Singleton instance

Constructor Detail

QNameback to summary
public QName(String name)
QNameback to summary
public QName(String name, Namespace namespace)
QNameback to summary
public QName(String name, Namespace namespace, String qualifiedName)

Method Detail

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
object:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getback to summary
public static QName get(String name)
getback to summary
public static QName get(String name, Namespace namespace)
getback to summary
public static QName get(String name, String prefix, String uri)
getback to summary
public static QName get(String qualifiedName, String uri)
getback to summary
public static QName get(String localName, Namespace namespace, String qualifiedName)
getCacheback to summary
private static QNameCache getCache()
getDocumentFactoryback to summary
public DocumentFactory getDocumentFactory()

DOCUMENT ME!

Returns:DocumentFactory

the factory that should be used for Elements of this QName

getNameback to summary
public String getName()

DOCUMENT ME!

Returns:String

the local name

getNamespaceback to summary
public Namespace getNamespace()

DOCUMENT ME!

Returns:Namespace

the namespace of this QName

getNamespacePrefixback to summary
public String getNamespacePrefix()

DOCUMENT ME!

Returns:String

the namespace URI of this QName

getNamespaceURIback to summary
public String getNamespaceURI()

DOCUMENT ME!

Returns:String

the namespace URI of this QName

getQualifiedNameback to summary
public String getQualifiedName()

DOCUMENT ME!

Returns:String

the qualified name in the format prefix:localName

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

DOCUMENT ME!

Returns:int

the hash code based on the qualified name and the URI of the namespace.

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
setDocumentFactoryback to summary
public void setDocumentFactory(DocumentFactory documentFactory)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

validateNameback to summary
private static void validateName(String name)
validateNCNameback to summary
protected static void validateNCName(String ncname)
validateQNameback to summary
private static void validateQName(String qname)
writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException