net.sf.saxon.value
Class QualifiedNameValue

java.lang.Object
  extended by net.sf.saxon.value.Value<AtomicValue>
      extended by net.sf.saxon.value.AtomicValue
          extended by net.sf.saxon.value.QualifiedNameValue
All Implemented Interfaces:
PullEvent, GroundedValue<AtomicValue>, Item<AtomicValue>, ValueRepresentation<AtomicValue>, ConversionResult
Direct Known Subclasses:
NotationValue, QNameValue

public abstract class QualifiedNameValue
extends AtomicValue

A qualified name: this is an abstract superclass for QNameValue and NotationValue, representing the XPath primitive types xs:QName and xs:NOTATION respectively


Field Summary
protected  StructuredQName 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
QualifiedNameValue()
           
 
Method Summary
 int allocateNameCode(NamePool pool)
          Allocate a nameCode for this QName in the NamePool
 String getClarkName()
          Get the QName in Clark notation, that is "{uri}local" if in a namespace, or "local" otherwise
 String getLocalName()
          Get the local part
 String getNamespaceURI()
          Get the namespace part.
 String getPrefix()
          Get the prefix.
 String getPrimitiveStringValue()
          Get the string value as a String.
 StructuredQName getStructuredQName()
          Get the equivalent StructuredQName
 Object getXPathComparable(boolean ordered, StringCollator collator, XPathContext context)
          Get an object value that implements the XPath equality and ordering comparison semantics for this value.
 int hashCode()
           
 boolean isIdentical(Value v)
          Determine whether two atomic values are identical, as determined by XML Schema rules.
static AtomicValue makeQName(String prefix, String uri, String local, AtomicType targetType, CharSequence lexicalForm, ConversionRules rules)
          Factory method to construct either a QName or a NOTATION value, or a subtype of either of these.
 QName toJaxpQName()
          Construct a javax.xml.namespace.QName from this QualifiedNameValue
 String toString()
          The toString() method returns the name in the form QName("uri", "local")
 StructuredQName toStructuredQName()
          Convert to a StructuredQName
 
Methods inherited from class net.sf.saxon.value.AtomicValue
asAtomic, checkPermittedContents, copyAsSubType, effectiveBooleanValue, equals, getCardinality, getComponent, getItemType, getLength, getPrimitiveType, getSchemaComparable, 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

qName

protected StructuredQName qName
Constructor Detail

QualifiedNameValue

public QualifiedNameValue()
Method Detail

makeQName

public static AtomicValue makeQName(String prefix,
                                    String uri,
                                    String local,
                                    AtomicType targetType,
                                    CharSequence lexicalForm,
                                    ConversionRules rules)
                             throws XPathException
Factory method to construct either a QName or a NOTATION value, or a subtype of either of these. Note that it is the caller's responsibility to resolve the QName prefix into a URI

Parameters:
prefix - the prefix part of the value. Use "" or null for the empty prefix.
uri - the namespace URI part of the value. Use "" or null for the non-namespace
local - the local part of the value
targetType - the target type, which must be xs:QName or a subtype of xs:NOTATION or xs:QName
lexicalForm - the original lexical form of the value. This is needed in case there are facets such as pattern that check the lexical form
rules - the conversion rules to be applied
Returns:
the converted value
Throws:
XPathException - if the value cannot be converted.

getPrimitiveStringValue

public final String getPrimitiveStringValue()
Get the string value as a String. Returns the QName as a lexical QName, retaining the original prefix if available.

Specified by:
getPrimitiveStringValue in class AtomicValue
Returns:
the value converted to a string according to the rules for the primitive type

toStructuredQName

public StructuredQName toStructuredQName()
Convert to a StructuredQName

Returns:
the name as a StructuredQName

getClarkName

public final String getClarkName()
Get the QName in Clark notation, that is "{uri}local" if in a namespace, or "local" otherwise

Returns:
the name in Clark notation

getLocalName

public final String getLocalName()
Get the local part

Returns:
the local part of the name (the part after the colon)

getNamespaceURI

public final String getNamespaceURI()
Get the namespace part. Returns the empty string for a name in no namespace.

Returns:
the namespace URI component of the name, or "" for a no-namespace name

getPrefix

public final String getPrefix()
Get the prefix. Returns the empty string if the name is unprefixed.

Returns:
the prefix, or "" to indicate no prefix

allocateNameCode

public int allocateNameCode(NamePool pool)
Allocate a nameCode for this QName in the NamePool

Parameters:
pool - the NamePool to be used
Returns:
the allocated nameCode

getXPathComparable

public Object getXPathComparable(boolean ordered,
                                 StringCollator collator,
                                 XPathContext context)
Get an object value that implements the XPath equality and ordering comparison semantics for this value. If the ordered parameter is set to true, the result will be a Comparable and will support a compareTo() method with the semantics of the XPath lt/gt operator, provided that the other operand is also obtained using the getXPathComparable() method. In all cases the result will support equals() and hashCode() methods that support the semantics of the XPath eq operator, again provided that the other operand is also obtained using the getXPathComparable() method. A context argument is supplied for use in cases where the comparison semantics are context-sensitive, for example where they depend on the implicit timezone or the default collation.

Specified by:
getXPathComparable in class AtomicValue
Parameters:
ordered - true if an ordered comparison is required. In this case the result is null if the type is unordered; in other cases the returned value will be a Comparable.
collator - the collation to be used for the comparison
context - the XPath dynamic evaluation context, used in cases where the comparison is context sensitive @return an Object whose equals() and hashCode() methods implement the XPath comparison semantics
Returns:
an Object whose equals() and hashCode() methods implement the XPath comparison semantics with respect to this atomic value. If ordered is specified, the result will either be null if no ordering is defined, or will be a Comparable

hashCode

public int hashCode()
Overrides:
hashCode in class Value<AtomicValue>

isIdentical

public boolean isIdentical(Value v)
Description copied from class: AtomicValue
Determine whether two atomic values are identical, as determined by XML Schema rules. This is a stronger test than equality (even schema-equality); for example two dateTime values are not identical unless they are in the same timezone.

Note that even this check ignores the type annotation of the value. The integer 3 and the short 3 are considered identical, even though they are not fully interchangeable. "Identical" means the same point in the value space, regardless of type annotation.

NaN is identical to itself.

Overrides:
isIdentical in class AtomicValue
Parameters:
v - the other value to be compared with this one
Returns:
true if the two values are identical, false otherwise.

toString

public String toString()
The toString() method returns the name in the form QName("uri", "local")

Overrides:
toString in class AtomicValue
Returns:
the name in in the form QName("uri", "local")

toJaxpQName

public QName toJaxpQName()
Construct a javax.xml.namespace.QName from this QualifiedNameValue

Returns:
an equivalent instance of the JAXP QName class

getStructuredQName

public StructuredQName getStructuredQName()
Get the equivalent StructuredQName

Returns:
the equivalent StructuredQName


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.