Package net.sf.saxon.value
Class QNameValue
- java.lang.Object
-
- net.sf.saxon.value.Value<AtomicValue>
-
- net.sf.saxon.value.AtomicValue
-
- net.sf.saxon.value.QualifiedNameValue
-
- net.sf.saxon.value.QNameValue
-
- All Implemented Interfaces:
PullEvent
,GroundedValue<AtomicValue>
,Item<AtomicValue>
,ValueRepresentation<AtomicValue>
,ConversionResult
public class QNameValue extends QualifiedNameValue
A QName value. This implements the so-called "triples proposal", in which the prefix is retained as part of the value. The prefix is not used in any operation on a QName other than conversion of the QName to a string.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.value.QualifiedNameValue
qName
-
Fields inherited from class net.sf.saxon.value.AtomicValue
typeLabel
-
Fields inherited from class net.sf.saxon.value.Value
INDETERMINATE_ORDERING
-
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
-
-
Constructor Summary
Constructors Constructor Description QNameValue(java.lang.String prefix, java.lang.String uri, java.lang.String localName)
Constructor for a QName that is known to be valid.QNameValue(java.lang.String prefix, java.lang.String uri, java.lang.String localName, AtomicType type)
Constructor for a QName that is known to be valid, allowing a user-defined subtype of QName to be specified.QNameValue(java.lang.String prefix, java.lang.String uri, java.lang.String localName, AtomicType type, NameChecker checker)
Constructor.QNameValue(NamePool namePool, int nameCode)
Constructor starting from a NamePool namecodeQNameValue(StructuredQName qName, AtomicType typeLabel)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicValue
copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type labelboolean
equals(java.lang.Object other)
Determine if two QName values are equal.AtomicValue
getComponent(int part)
Get a component.BuiltInAtomicType
getPrimitiveType()
Determine the primitive type of the value.java.lang.Comparable
getSchemaComparable()
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value.-
Methods inherited from class net.sf.saxon.value.QualifiedNameValue
allocateNameCode, getClarkName, getLocalName, getNamespaceURI, getPrefix, getPrimitiveStringValue, getStructuredQName, getXPathComparable, hashCode, isIdentical, makeQName, toJaxpQName, toString, toStructuredQName
-
Methods inherited from class net.sf.saxon.value.AtomicValue
asAtomic, checkPermittedContents, effectiveBooleanValue, getCardinality, getItemType, getLength, getStringValue, getStringValueCS, getTypedValue, getTypeLabel, isNaN, itemAt, iterate, process, setTypeLabel, subsequence
-
Methods inherited from class net.sf.saxon.value.Value
asItem, asItem, asIterator, asValue, convertToJava, fromItem, getCanonicalLexicalRepresentation, getIterator, getSequenceLength, reduce
-
-
-
-
Constructor Detail
-
QNameValue
public QNameValue(java.lang.String prefix, java.lang.String uri, java.lang.String localName)
Constructor for a QName that is known to be valid. No validation takes place.- Parameters:
prefix
- The prefix part of the QName (not used in comparisons). Use "" to represent the default prefix.uri
- The namespace part of the QName. Use "" to represent the non-namespace.localName
- The local part of the QName
-
QNameValue
public QNameValue(java.lang.String prefix, java.lang.String uri, java.lang.String localName, AtomicType type)
Constructor for a QName that is known to be valid, allowing a user-defined subtype of QName to be specified. No validation takes place.- Parameters:
prefix
- The prefix part of the QName (not used in comparisons). Use "" to represent the default prefix (but null is also accepted)uri
- The namespace part of the QName. Use null to represent the non-namespace (but "" is also accepted).localName
- The local part of the QNametype
- The type label, xs:QName or a subtype of xs:QName
-
QNameValue
public QNameValue(NamePool namePool, int nameCode)
Constructor starting from a NamePool namecode- Parameters:
namePool
- The name pool containing the specified name codenameCode
- The name code identifying this name in the name pool
-
QNameValue
public QNameValue(java.lang.String prefix, java.lang.String uri, java.lang.String localName, AtomicType type, NameChecker checker) throws XPathException
Constructor. This constructor validates that the local part is a valid NCName.- Parameters:
prefix
- The prefix part of the QName (not used in comparisons). Use "" to represent the default prefix (but null is also accepted). Note that the prefix is not checked for lexical correctness, because in most cases it will already have been matched against in-scope namespaces. Where necessary the caller must check the prefix.uri
- The namespace part of the QName. Use null to represent the non-namespace (but "" is also accepted).localName
- The local part of the QNametype
- The atomic type, which must be either xs:QName, or a user-defined type derived from xs:QName by restrictionchecker
- NameChecker used to check the name against XML 1.0 or XML 1.1 rules. Supply null if the name does not need to be checked (the caller asserts that it is known to be valid)- Throws:
XPathException
- if the local part of the name is malformed or if the name has a null namespace with a non-empty prefix
-
QNameValue
public QNameValue(StructuredQName qName, AtomicType typeLabel)
Constructor- Parameters:
qName
- the name as a StructuredQNametypeLabel
- idenfies a subtype of xs:QName
-
-
Method Detail
-
copyAsSubType
public AtomicValue copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label- Specified by:
copyAsSubType
in classAtomicValue
- Parameters:
typeLabel
- the type label of the new copy. The caller is responsible for checking that the value actually conforms to this type.- Returns:
- the copied value
-
getPrimitiveType
public BuiltInAtomicType getPrimitiveType()
Determine the primitive type of the value. This delivers the same answer as getItemType().getPrimitiveItemType(). The primitive types are the 19 primitive types of XML Schema, plus xs:integer, xs:dayTimeDuration and xs:yearMonthDuration, and xs:untypedAtomic. For external objects, the result is AnyAtomicType.- Specified by:
getPrimitiveType
in classAtomicValue
- Returns:
- the primitive type
-
getComponent
public AtomicValue getComponent(int part)
Get a component. Returns a zero-length string if the namespace-uri component is requested and is not present.- Overrides:
getComponent
in classAtomicValue
- Parameters:
part
- either Component.LOCALNAME or Component.NAMESPACE indicating which component of the value is required- Returns:
- either the local name or the namespace URI, in each case as a StringValue
-
equals
public boolean equals(java.lang.Object other)
Determine if two QName values are equal. This comparison ignores the prefix part of the value.- Specified by:
equals
in classAtomicValue
- Parameters:
other
- the other value- Returns:
- true if the other operand is an atomic value and the two values are equal as defined by the XPath eq operator
- Throws:
java.lang.ClassCastException
- if they are not comparable
-
getSchemaComparable
public java.lang.Comparable getSchemaComparable()
Description copied from class:AtomicValue
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. An implementation must be provided for all atomic types.In the case of data types that are partially ordered, the returned Comparable extends the standard semantics of the compareTo() method by returning the value
Value.INDETERMINATE_ORDERING
when there is no defined order relationship between two given values. This value is also returned when two values of different types are compared.- Specified by:
getSchemaComparable
in classAtomicValue
- Returns:
- a Comparable that follows XML Schema comparison rules
-
-