net.sf.saxon.value
Class QNameValue
- ConversionResult, GroundedValue, Item, PullEvent, Serializable, SequenceIterable, Serializable, ValueRepresentation
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.
QNameValue(String prefix, String uri, String localName) - Constructor for a QName that is known to be valid.
|
QNameValue(String prefix, String uri, 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(String prefix, String uri, String localName, AtomicType type, NameChecker checker) - Constructor.
|
QNameValue(NamePool namePool, int nameCode) - Constructor starting from a NamePool namecode
|
QNameValue(StructuredQName qName, AtomicType typeLabel) - Constructor
|
allocateNameCode , convertToJava , getClarkName , getLocalName , getNamespaceURI , getPrefix , getStringValue , getXPathComparable , hashCode , makeQName , makeQName , toString |
asAtomic , checkPermittedContents , convert , convert , convertPrimitive , copyAsSubType , effectiveBooleanValue , equals , getCardinality , getComponent , getItemType , getLength , getPrimitiveType , getSchemaComparable , getStringValue , getStringValueCS , getTypeLabel , getTypedValue , getXPathComparable , isNaN , itemAt , iterate , process , setTypeLabel , subsequence , toString |
asItem , asItem , asIterator , asValue , checkPermittedContents , convertJavaObjectToXPath , convertToJava , convertToJava , effectiveBooleanValue , equals , fromItem , getCanonicalLexicalRepresentation , getCardinality , getItemType , getIterator , getLength , getSchemaComparable , getStringValue , getStringValueCS , itemAt , iterate , iterate , makeQNameValue , process , reduce , stringToNumber , toString |
QNameValue
public QNameValue(String prefix,
String uri,
String localName)
Constructor for a QName that is known to be valid. No validation takes place.
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(String prefix,
String uri,
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.
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(String prefix,
String uri,
String localName,
AtomicType type,
NameChecker checker)
throws XPathException
Constructor. This constructor validates that the local part is a valid NCName.
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)
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(NamePool namePool,
int nameCode)
Constructor starting from a NamePool namecode
namePool
- The name pool containing the specified name codenameCode
- The name code identifying this name in the name pool
QNameValue
public QNameValue(StructuredQName qName,
AtomicType typeLabel)
Constructor
qName
- the name as a StructuredQNametypeLabel
- idenfies a subtype of xs:QName
convertPrimitive
public ConversionResult convertPrimitive(BuiltInAtomicType requiredType,
boolean validate,
XPathContext context)
Convert a QName to target data type
- convertPrimitive in interface AtomicValue
requiredType
- an integer identifying the required atomic typecontext
- XPath dynamic context
- an AtomicValue, a value of the required type; or an ErrorValue
copyAsSubType
public AtomicValue copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label
- copyAsSubType in interface AtomicValue
typeLabel
- the type label of the new copy. The caller is responsible for checking that
the value actually conforms to this type.
equals
public boolean equals(Object other)
Determine if two QName values are equal. This comparison ignores the prefix part
of the value.
- equals in interface AtomicValue
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.
- getComponent in interface AtomicValue
part
- either Component.LOCALNAME or Component.NAMESPACE indicating which
component of the value is required
- either the local name or the namespace URI, in each case as a StringValue
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.
- getPrimitiveType in interface AtomicValue
getSchemaComparable
public Comparable getSchemaComparable()
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.
- getSchemaComparable in interface AtomicValue
- a Comparable that follows XML Schema comparison rules
toStructuredQName
public StructuredQName toStructuredQName()
Convert to a StructuredQName
- the name as a StructuredQName