net.sf.saxon.om

## Interface Item

- All Superinterfaces:
    PullEvent, Sequence
  All Known Subinterfaces:
    DocumentInfo, FunctionItem, MapItem, MutableNodeInfo, NodeInfo, SiblingCountingNode, SteppingNode<N>, VirtualNode
  All Known Implementing Classes:
    AbsentExtensionElement, AbstractFunctionItem, AbstractItem, AbstractNodeWrapper, AbstractVirtualNode, AnnotationParent, AnyURIValue, AtomicConstructorFunctionItem, AtomicValue, AxiomAttributeWrapper, AxiomDocumentWrapper, AxiomElementNodeWrapper, AxiomLeafNodeWrapper, AxiomParentNodeWrapper, Base64BinaryValue, BigIntegerValue, BooleanValue, CalendarValue, CallableFunctionItem, CoercedFunction, CurriedFunction, DataElement, DateTimeValue, DateValue, DayTimeDurationValue, DecimalValue, DocumentImpl, DocumentWrapper, DOM4JDocumentWrapper, DOM4JNodeWrapper, DOMNodeWrapper, DoubleValue, DurationValue, ElementImpl, ExtensionInstruction, FleetingDocumentNode, FleetingElementNode, FleetingNode, FleetingParentNode, FloatValue, GDateValue, GDayValue, GMonthDayValue, GMonthValue, GYearMonthValue, GYearValue, HexBinaryValue, ImmutableMap, Int64Value, IntegerValue, JDOM2DocumentWrapper, JDOM2NodeWrapper, JDOMDocumentWrapper, JDOMNodeWrapper, LiteralResultElement, NamespaceNode, NodeImpl, NotationValue, NumericValue, ObjectValue, Orphan, QNameValue, QualifiedNameValue, RangeKey, SaxonAssign, SaxonCallTemplate, SaxonCollation, SaxonDoctype, SaxonEntityRef, SaxonImportQuery, SaxonParam, SaxonPreprocess, SaxonWhile, SchemaElement, SingletonMap, SpaceStrippedDocument, SpaceStrippedNode, SQLClose, SQLColumn, SQLConnect, SQLDelete, SQLExecute, SQLInsert, SQLQuery, SQLUpdate, StringValue, StyleElement, TextFragmentValue, TextImpl, TextValueTemplateNode, TimeValue, TinyDocumentImpl, TinyElementImpl, TinyNodeImpl, TinyParentNodeImpl, TinyTextImpl, Tuple, TypeStrippedDocument, TypeStrippedNode, UnconstructedDocument, UnconstructedElement, UnconstructedParent, UnknownElement, UntypedAtomicValue, UserFunctionItem, VirtualCopy, VirtualDocumentCopy, VirtualUntypedCopy, WhitespaceTextImpl, XOMDocumentWrapper, XOMNodeWrapper, XSDAlternative, XSDAnnotation, XSDAny, XSDAnyAttribute, XSDAssert, XSDAttribute, XSDAttributeGroup, XSDComplexContent, XSDComplexContentRestriction, XSDComplexType, XSDCompositor, XSDDefaultOpenContent, XSDDocumentation, XSDElement, XSDExtension, XSDFacet, XSDFieldOrSelector, XSDGroup, XSDIdentityConstraint, XSDImport, XSDInclude, XSDList, XSDNotation, XSDOpenContent, XSDOverride, XSDRedefine, XSDSchema, XSDSimpleContent, XSDSimpleContentRestriction, XSDSimpleType, XSDSimpleTypeRestriction, XSDUnion, XSLAccumulator, XSLAccumulatorRule, XSLAnalyzeString, XSLApplyImports, XSLApplyTemplates, XSLAssert, XSLAttribute, XSLAttributeSet, XSLBreak, XSLBreakOrContinue, XSLCallTemplate, XSLCatch, XSLCharacterMap, XSLChoose, XSLComment, XSLCopy, XSLCopyOf, XSLDecimalFormat, XSLDocument, XSLElement, XSLEvaluate, XSLFallback, XSLForEach, XSLForEachGroup, XSLFork, XSLFunction, XSLGeneralIncorporate, XSLGeneralVariable, XSLGlobalParam, XSLGlobalVariable, XSLIf, XSLImport, XSLImportSchema, XSLInclude, XSLIterate, XSLKey, XSLLeafNodeConstructor, XSLLocalParam, XSLLocalVariable, XSLMap, XSLMapEntry, XSLMatchingSubstring, XSLMerge, XSLMergeAction, XSLMergeKey, XSLMergeSource, XSLMessage, XSLMode, XSLNamespace, XSLNamespaceAlias, XSLNextIteration, XSLNextMatch, XSLNumber, XSLOnCompletion, XSLOtherwise, XSLOutput, XSLOutputCharacter, XSLPerformSort, XSLPreserveSpace, XSLProcessingInstruction, XSLResultDocument, XSLSequence, XSLSort, XSLSortOrMergeKey, XSLStream, XSLStylesheet, XSLTemplate, XSLText, XSLTry, XSLValueOf, XSLWhen, XSLWithParam, YearMonthDurationValue

      public interface Item
      extends Sequence, PullEvent

  An Item is an object that can occur as a member of a sequence. It corresponds directly to the concept of an item in the XPath 2.0 data model. There are two kinds of Item: atomic values, and nodes.

  This interface is part of the public Saxon API. As such (starting from Saxon 8.4), methods that form part of the stable API are labelled with a JavaDoc "since" tag to identify the Saxon release at which they were introduced.

  Note: there is no method getItemType(). This is to avoid having to implement it on every implementation of NodeInfo. Instead, use the static method Type.getItemType(Item).

  Since:
    8.4
  Author:
    Michael H. Kay

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getStringValue()` Get the value of the item as a string.
    `CharSequence` | `getStringValueCS()` Get the string value of the item as a CharSequence.

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `head, iterate`

- - ### Method Detail

    - #### getStringValue

          String getStringValue()

      Get the value of the item as a string. For nodes, this is the string value of the node as defined in the XPath 2.0 data model, except that all nodes are treated as being untyped: it is not an error to get the string value of a node with a complex type. For atomic values, the method returns the result of casting the atomic value to a string.

      If the calling code can handle any CharSequence, the method `getStringValueCS()` should be used. If the caller requires a string, this method is preferred.

      Returns:
        the string value of the item
      Throws:
        `UnsupportedOperationException` - if the item is a function item (an unchecked exception is used here to avoid introducing exception handling to a large number of paths where it is not needed)
      Since:
        8.4
      See Also:
        `getStringValueCS()`

    - #### getStringValueCS

          CharSequence getStringValueCS()

      Get the string value of the item as a CharSequence. This is in some cases more efficient than the version of the method that returns a String. The method satisfies the rule that `X.getStringValueCS().toString()` returns a string that is equal to `X.getStringValue()`.

      Note that two CharSequence values of different types should not be compared using equals(), and for the same reason they should not be used as a key in a hash table.

      If the calling code can handle any CharSequence, this method should be used. If the caller requires a string, the `getStringValue()` method is preferred.

      Returns:
        the string value of the item
      Throws:
        `UnsupportedOperationException` - if the item is a function item (an unchecked exception is used here to avoid introducing exception handling to a large number of paths where it is not needed)
      Since:
        8.4
      See Also:
        `getStringValue()`

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