public class QName
extends java.lang.Object
This class also defines a number of QName-valued constants relating to built-in types in XML Schema
A QName is immutable.
Note that a QName is not itself an XdmItem
in this model; however it can be wrapped in an
XdmItem.
Modifier and Type | Field and Description |
---|---|
static QName |
XS_ANY_ATOMIC_TYPE
QName denoting the schema type xs:anyAtomicType *
|
static QName |
XS_ANY_URI
QName denoting the schema type xs:anyURI *
|
static QName |
XS_BASE64_BINARY
QName denoting the schema type xs:base64Binary *
|
static QName |
XS_BOOLEAN
QName denoting the schema type xs:boolean *
|
static QName |
XS_BYTE
QName denoting the schema type xs:byte *
|
static QName |
XS_DATE
QName denoting the schema type xs:date *
|
static QName |
XS_DATE_TIME
QName denoting the schema type xs:dateTime *
|
static QName |
XS_DATE_TIME_STAMP
QName denoting the schema type xs:dateTimeStamp *
|
static QName |
XS_DAY_TIME_DURATION
QName denoting the schema type xs:dayTimeDuration *
|
static QName |
XS_DECIMAL
QName denoting the schema type xs:decimal *
|
static QName |
XS_DOUBLE
QName denoting the schema type xs:double *
|
static QName |
XS_DURATION
QName denoting the schema type xs:duration *
|
static QName |
XS_ENTITIES
QName denoting the schema type xs:ENTITIES *
|
static QName |
XS_ENTITY
QName denoting the schema type xs:ENTITY *
|
static QName |
XS_FLOAT
QName denoting the schema type xs:float *
|
static QName |
XS_G_DAY
QName denoting the schema type xs:gDay *
|
static QName |
XS_G_MONTH
QName denoting the schema type xs:gMonth *
|
static QName |
XS_G_MONTH_DAY
QName denoting the schema type xs:gMonthDay *
|
static QName |
XS_G_YEAR
QName denoting the schema type xs:gYear *
|
static QName |
XS_G_YEAR_MONTH
QName denoting the schema type xs:gYearMonth *
|
static QName |
XS_HEX_BINARY
QName denoting the schema type xs:hexBinary *
|
static QName |
XS_ID
QName denoting the schema type xs:ID *
|
static QName |
XS_IDREF
QName denoting the schema type xs:IDREF *
|
static QName |
XS_IDREFS
QName denoting the schema type xs:IDREFS *
|
static QName |
XS_INT
QName denoting the schema type xs:int *
|
static QName |
XS_INTEGER
QName denoting the schema type xs:integer *
|
static QName |
XS_LANGUAGE
QName denoting the schema type xs:language *
|
static QName |
XS_LONG
QName denoting the schema type xs:long *
|
static QName |
XS_NAME
QName denoting the schema type xs:Name *
|
static QName |
XS_NCNAME
QName denoting the schema type xs:NCName *
|
static QName |
XS_NEGATIVE_INTEGER
QName denoting the schema type xs:negativeInteger *
|
static QName |
XS_NMTOKEN
QName denoting the schema type xs:NMTOKEN *
|
static QName |
XS_NMTOKENS
QName denoting the schema type xs:NMTOKENS *
|
static QName |
XS_NON_NEGATIVE_INTEGER
QName denoting the schema type xs:nonNegativeInteger *
|
static QName |
XS_NON_POSITIVE_INTEGER
QName denoting the schema type xs:nonPositiveInteger *
|
static QName |
XS_NORMALIZED_STRING
QName denoting the schema type xs:normalizedString *
|
static QName |
XS_NOTATION
QName denoting the schema type xs:NOTATION *
|
static QName |
XS_POSITIVE_INTEGER
QName denoting the schema type xs:positiveInteger *
|
static QName |
XS_QNAME
QName denoting the schema type xs:QName *
|
static QName |
XS_SHORT
QName denoting the schema type xs:short *
|
static QName |
XS_STRING
QName denoting the schema type xs:string *
|
static QName |
XS_TIME
QName denoting the schema type xs:time *
|
static QName |
XS_TOKEN
QName denoting the schema type xs:token *
|
static QName |
XS_UNSIGNED_BYTE
QName denoting the schema type xs:unsignedByte *
|
static QName |
XS_UNSIGNED_INT
QName denoting the schema type xs:unsignedInt *
|
static QName |
XS_UNSIGNED_LONG
QName denoting the schema type xs:unsignedLong *
|
static QName |
XS_UNSIGNED_SHORT
QName denoting the schema type xs:unsignedShort *
|
static QName |
XS_UNTYPED
QName denoting the schema type xs:untyped *
|
static QName |
XS_UNTYPED_ATOMIC
QName denoting the schema type xs:untypedAtomic *
|
static QName |
XS_YEAR_MONTH_DURATION
QName denoting the schema type xs:yearMonthDuration *
|
Constructor and Description |
---|
QName(javax.xml.namespace.QName qName)
Construct a QName from a JAXP QName object
|
QName(java.lang.String localName)
Construct a QName from a localName alone.
|
QName(java.lang.String uri,
java.lang.String lexical)
Construct a QName using a namespace URI and a lexical representation.
|
QName(java.lang.String prefix,
java.lang.String uri,
java.lang.String localName)
Construct a QName using a namespace prefix, a namespace URI, and a local name (in that order).
|
QName(java.lang.String lexicalQName,
XdmNode element)
Construct a QName from a lexical QName, supplying an element node whose
in-scope namespaces are to be used to resolve any prefix contained in the QName.
|
QName(StructuredQName sqName)
Construct a QName from a StructuredQName
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
Test whether two QNames are equal.
|
static QName |
fromClarkName(java.lang.String expandedName)
Factory method to construct a QName from a string containing the expanded
QName in Clark notation, that is,
{uri}local
The prefix part of the QName will be set to an empty string. |
static QName |
fromEQName(java.lang.String expandedName)
Factory method to construct a QName from a string containing the expanded
QName in EQName notation, that is,
Q{uri}local
The prefix part of the QName will be set to an empty string. |
java.lang.String |
getClarkName()
The expanded name, as a string using the notation devised by James Clark.
|
java.lang.String |
getEQName() |
java.lang.String |
getLocalName()
The local part of the QName
|
java.lang.String |
getNamespaceURI()
The namespace URI of the QName.
|
java.lang.String |
getPrefix()
Get the prefix of the QName.
|
StructuredQName |
getStructuredQName()
Get the underlying StructuredQName
|
int |
hashCode()
Get a hash code for the QName, to support equality matching.
|
boolean |
isValid(Processor processor)
Validate the QName against the XML 1.0 or XML 1.1 rules for valid names.
|
java.lang.String |
toString()
Convert the value to a string.
|
public static final QName XS_STRING
public static final QName XS_BOOLEAN
public static final QName XS_DECIMAL
public static final QName XS_FLOAT
public static final QName XS_DOUBLE
public static final QName XS_DURATION
public static final QName XS_DATE_TIME
public static final QName XS_TIME
public static final QName XS_DATE
public static final QName XS_G_YEAR_MONTH
public static final QName XS_G_YEAR
public static final QName XS_G_MONTH_DAY
public static final QName XS_G_DAY
public static final QName XS_G_MONTH
public static final QName XS_HEX_BINARY
public static final QName XS_BASE64_BINARY
public static final QName XS_ANY_URI
public static final QName XS_QNAME
public static final QName XS_NOTATION
public static final QName XS_INTEGER
public static final QName XS_NON_POSITIVE_INTEGER
public static final QName XS_NEGATIVE_INTEGER
public static final QName XS_LONG
public static final QName XS_INT
public static final QName XS_SHORT
public static final QName XS_BYTE
public static final QName XS_NON_NEGATIVE_INTEGER
public static final QName XS_POSITIVE_INTEGER
public static final QName XS_UNSIGNED_LONG
public static final QName XS_UNSIGNED_INT
public static final QName XS_UNSIGNED_SHORT
public static final QName XS_UNSIGNED_BYTE
public static final QName XS_NORMALIZED_STRING
public static final QName XS_TOKEN
public static final QName XS_LANGUAGE
public static final QName XS_NMTOKEN
public static final QName XS_NMTOKENS
public static final QName XS_NAME
public static final QName XS_NCNAME
public static final QName XS_ID
public static final QName XS_IDREF
public static final QName XS_IDREFS
public static final QName XS_ENTITY
public static final QName XS_ENTITIES
public static final QName XS_UNTYPED
public static final QName XS_UNTYPED_ATOMIC
public static final QName XS_ANY_ATOMIC_TYPE
public static final QName XS_YEAR_MONTH_DURATION
public static final QName XS_DAY_TIME_DURATION
public static final QName XS_DATE_TIME_STAMP
public QName(java.lang.String prefix, java.lang.String uri, java.lang.String localName)
This constructor does not check that the components of the QName are lexically valid.
prefix
- The prefix of the name. Use either the string "" or null for names that have
no prefix (that is, they are in the default namespace)uri
- The namespace URI. Use either the string "" or null for names that are not in any namespace.localName
- The local part of the namepublic QName(java.lang.String uri, java.lang.String lexical)
This constructor does not check that the components of the QName are lexically valid.
uri
- The namespace URI. Use either the string "" or null for names that are not in any namespace.lexical
- Either the local part of the name, or the prefix and local part in the format prefix:localpublic QName(java.lang.String localName)
localName
- The local name. This must be a valid NCName, in particular it must contain no colonpublic QName(java.lang.String lexicalQName, XdmNode element)
This constructor checks that the components of the QName are lexically valid.
If the lexical QName has no prefix, the name is considered to be in the
default namespace, as defined by xmlns="..."
.
If the prefix of the lexical QName is not in scope, returns null.
lexicalQName
- The lexical QName, in the form prefix:local
or simply local
. The EQName syntax "Q{uri}local"
and the ClarkName syntax "{uri}local" are also accepted.element
- The element node whose in-scope namespaces are to be used
to resolve the prefix part of the lexical QName.java.lang.IllegalArgumentException
- If the prefix of the lexical QName is not in scope
or if the lexical QName is invalid (for example, if it contains invalid characters)public QName(javax.xml.namespace.QName qName)
qName
- the JAXP QName objectpublic QName(StructuredQName sqName)
sqName
- the StructuredQNamepublic static QName fromClarkName(java.lang.String expandedName) throws java.lang.IllegalArgumentException
{uri}local
The prefix part of the QName
will be set to an empty string.
expandedName
- The URI in Clark notation: {uri}local
if the
name is in a namespace, or simply local
if not.java.lang.IllegalArgumentException
- if the format of the supplied name is incorrectpublic static QName fromEQName(java.lang.String expandedName)
Q{uri}local
The prefix part of the QName
will be set to an empty string.
expandedName
- The URI in EQName notation: Q{uri}local
if the
name is in a namespace. For a name in no namespace, either of the
forms Q{}local
or simply local
are accepted.public boolean isValid(Processor processor)
processor
- The Processor in which the name is to be validated.
This was at one time used to determine whether the
XML 1.0 or XML 1.1 rules for forming names are used. However,
the XML 1.0 and 1.1 rules are now aligned, so this argument
is no longer used.public java.lang.String getPrefix()
public java.lang.String getNamespaceURI()
public java.lang.String getLocalName()
public java.lang.String getClarkName()
{uri}local
.
Otherwise, the value is the local part of the name.public java.lang.String getEQName()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public StructuredQName getStructuredQName()
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.