|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.value.Value net.sf.saxon.value.AtomicValue net.sf.saxon.value.QualifiedNameValue net.sf.saxon.value.QNameValue
public class QNameValue
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.Value |
---|
EMPTY_CLASS_ARRAY, INDETERMINATE_ORDERING |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Constructor Summary | |
---|---|
QNameValue(NamePool namePool,
int nameCode)
Constructor starting from a NamePool namecode |
|
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(StructuredQName qName,
AtomicType typeLabel)
Constructor |
Method Summary | |
---|---|
ConversionResult |
convertPrimitive(BuiltInAtomicType requiredType,
boolean validate,
XPathContext context)
Convert a QName to target data type |
AtomicValue |
copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label |
boolean |
equals(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. |
Comparable |
getSchemaComparable()
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. |
StructuredQName |
toStructuredQName()
Convert to a StructuredQName |
Methods inherited from class net.sf.saxon.value.QualifiedNameValue |
---|
allocateNameCode, convertToJava, getClarkName, getLocalName, getNamespaceURI, getPrefix, getStringValue, getXPathComparable, hashCode, makeQName, makeQName, toString |
Methods inherited from class net.sf.saxon.value.AtomicValue |
---|
asAtomic, checkPermittedContents, convert, convert, effectiveBooleanValue, getCardinality, getItemType, getLength, getStringValueCS, getTypedValue, getTypeLabel, isNaN, itemAt, iterate, process, setTypeLabel, subsequence |
Methods inherited from class net.sf.saxon.value.Value |
---|
asItem, asItem, asIterator, asValue, convertJavaObjectToXPath, convertToJava, fromItem, getCanonicalLexicalRepresentation, getIterator, iterate, makeQNameValue, reduce, stringToNumber |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QNameValue(String prefix, String uri, String localName)
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 QNamepublic QNameValue(String prefix, String uri, String localName, AtomicType type)
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:QNamepublic QNameValue(NamePool namePool, int nameCode)
namePool
- The name pool containing the specified name codenameCode
- The name code identifying this name in the name poolpublic QNameValue(String prefix, String uri, String localName, AtomicType type, NameChecker checker) throws XPathException
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 prefixpublic QNameValue(StructuredQName qName, AtomicType typeLabel)
qName
- the name as a StructuredQNametypeLabel
- idenfies a subtype of xs:QNameMethod Detail |
---|
public StructuredQName toStructuredQName()
public AtomicValue copyAsSubType(AtomicType typeLabel)
copyAsSubType
in class AtomicValue
typeLabel
- the type label of the new copy. The caller is responsible for checking that
the value actually conforms to this type.
public BuiltInAtomicType getPrimitiveType()
getPrimitiveType
in class AtomicValue
public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
requiredType
- an integer identifying the required atomic typecontext
- XPath dynamic contextvalidate
- true if validation is required. If set to false, the caller guarantees that
the value is valid for the target data type, and that further validation
is therefore not required.
Note that a validation failure may be reported even if validation was not requested.
public AtomicValue getComponent(int part)
getComponent
in class AtomicValue
part
- either Component.LOCALNAME or Component.NAMESPACE indicating which
component of the value is required
public boolean equals(Object other)
equals
in class AtomicValue
other
- the other value
ClassCastException
- if they are not comparablepublic Comparable getSchemaComparable()
AtomicValue
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 class AtomicValue
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |