Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.value
Class QNameValue

    java.lang.Object
      net.sf.saxon.value.Value
          net.sf.saxon.value.AtomicValue
              net.sf.saxon.value.QualifiedNameValue
                  net.sf.saxon.value.QNameValue

All Implemented Interfaces:
  Serializable, Comparable, SequenceIterable, Item, ValueRepresentation

    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.

See Also:
  Serialized Form

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`

Constructor Summary
`QNameValue(NamePool namePool, int nameCode)` Constructor
`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.

Method Summary
`AtomicValue` | `convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)` Convert a QName to target data type
`AtomicValue` | `copy(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.

Methods inherited from class net.sf.saxon.value.QualifiedNameValue
`allocateNameCode, convertToJava, getClarkName, getLocalName, getNamespaceURI, getPrefix, getStringValue, hashCode, makeQName, makeQName, toString`

Methods inherited from class net.sf.saxon.value.AtomicValue
`checkPermittedContents, convert, convert, effectiveBooleanValue, getCardinality, getItemType, getLength, getStringValueCS, getTypedValue, getTypeLabel, getXPathComparable, hasBuiltInType, isMultiValued, itemAt, iterate, process, setTypeLabel`

Methods inherited from class net.sf.saxon.value.Value
`asItem, asItem, asIterator, asValue, compareTo, convert, convertJavaObjectToXPath, fromItem, getCanonicalLexicalRepresentation, getIterator, getSchemaComparable, iterate, makeQNameValue, reduce, stringToNumber`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### QNameValue

    public QNameValue(NamePool namePool,
                      int nameCode)

  Constructor

  Parameters:
    `namePool` - The name pool containing the specified name code
    `nameCode` - The name code identifying this name in the name pool

### QNameValue

    public QNameValue(String prefix,
                      String uri,
                      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(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.

  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 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.

  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 QName
    `type` - The atomic type, which must be either xs:QName, or a user-defined type derived from xs:QName by restriction
    `checker` - 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`

Method Detail

### copy

    public AtomicValue copy(AtomicType typeLabel)

  Create a copy of this atomic value, with a different type label

  Specified by:
    `copy` in class `AtomicValue`
  Parameters:
    `typeLabel` - the type label of the new copy. The caller is responsible for checking that the value actually conforms to this type.

### 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 class `AtomicValue`

### convertPrimitive

    public AtomicValue convertPrimitive(BuiltInAtomicType requiredType,
                                        boolean validate,
                                        XPathContext context)

  Convert a QName to target data type

  Specified by:
    `convertPrimitive` in class `AtomicValue`
  Parameters:
    `requiredType` - an integer identifying the required atomic type
    `context` -
    `validate` - 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.
  Returns:
    an AtomicValue, a value of the required type; or an ErrorValue

### 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 class `AtomicValue`
  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(Object other)

  Determine if two QName values are equal. This comparison ignores the prefix part of the value.

  Overrides:
    `equals` in class `Value`
  Throws:
    `ClassCastException` - if they are not comparable
    `IllegalStateException` - if the two QNames are in different name pools

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.