Interface Item
- All Superinterfaces:
ValueRepresentation
- All Known Subinterfaces:
DocumentInfo
,ExtendedNodeInfo
,NodeInfo
,SiblingCountingNode
,VirtualNode
- All Known Implementing Classes:
AbsentExtensionElement
,AnyURIValue
,AtomicValue
,AttributeImpl
,Base64BinaryValue
,BigIntegerValue
,BooleanValue
,CalendarValue
,CommentImpl
,DataElement
,DateTimeValue
,DateValue
,DecimalValue
,DocumentImpl
,DocumentWrapper
,DocumentWrapper
,DocumentWrapper
,DocumentWrapper
,DoubleValue
,DurationValue
,ElementImpl
,ElementWithAttributes
,ExtensionInstruction
,FloatValue
,GDayValue
,GMonthDayValue
,GMonthValue
,GYearMonthValue
,GYearValue
,HexBinaryValue
,IntegerValue
,LiteralResultElement
,MonthDurationValue
,NamespaceIterator.NamespaceNodeImpl
,NodeImpl
,NodeWrapper
,NodeWrapper
,NodeWrapper
,NodeWrapper
,NotationValue
,NumericValue
,ObjectValue
,Orphan
,ParentNodeImpl
,ProcInstImpl
,QNameValue
,RestrictedStringValue
,SaxonAssign
,SaxonCallTemplate
,SaxonCollation
,SaxonDoctype
,SaxonEntityRef
,SaxonImportQuery
,SaxonScript
,SaxonWhile
,SecondsDurationValue
,SQLClose
,SQLColumn
,SQLConnect
,SQLDelete
,SQLInsert
,SQLQuery
,SQLUpdate
,StringValue
,StrippedDocument
,StrippedNode
,StyleElement
,TextFragmentValue
,TextImpl
,TimeValue
,TinyAttributeImpl
,TinyCommentImpl
,TinyDocumentImpl
,TinyElementImpl
,TinyNodeImpl
,TinyParentNodeImpl
,TinyProcInstImpl
,TinyTextImpl
,UnconstructedDocument
,UnconstructedElement
,UnconstructedParent
,UntypedAtomicValue
,ValidationErrorValue
,VirtualCopy
,VirtualDocumentCopy
,WhitespaceTextImpl
,XSLAnalyzeString
,XSLApplyImports
,XSLApplyTemplates
,XSLAttribute
,XSLAttributeSet
,XSLCallTemplate
,XSLCharacterMap
,XSLChoose
,XSLComment
,XSLCopy
,XSLCopyOf
,XSLDecimalFormat
,XSLDocument
,XSLElement
,XSLFallback
,XSLForEach
,XSLForEachGroup
,XSLFunction
,XSLGeneralIncorporate
,XSLGeneralVariable
,XSLIf
,XSLImport
,XSLImportSchema
,XSLInclude
,XSLKey
,XSLMatchingSubstring
,XSLMessage
,XSLNamespace
,XSLNamespaceAlias
,XSLNextMatch
,XSLNumber
,XSLOtherwise
,XSLOutput
,XSLOutputCharacter
,XSLParam
,XSLPerformSort
,XSLPreserveSpace
,XSLProcessingInstruction
,XSLResultDocument
,XSLSequence
,XSLSort
,XSLStringConstructor
,XSLStylesheet
,XSLTemplate
,XSLText
,XSLValueOf
,XSLVariable
,XSLVariableDeclaration
,XSLWhen
,XSLWithParam
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
-
Field Summary
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionGet the value of the item as a string.Get the string value of the item as a CharSequence.Get the typed value of the item.
-
Method Details
-
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.- Specified by:
getStringValue
in interfaceValueRepresentation
- Returns:
- the string value of the item
- Since:
- 8.4
- See Also:
-
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 thatX.getStringValueCS().toString()
returns a string that is equal toX.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.- Specified by:
getStringValueCS
in interfaceValueRepresentation
- Returns:
- the string value of the item
- Since:
- 8.4
- See Also:
-
getTypedValue
Get the typed value of the item.For a node, this is the typed value as defined in the XPath 2.0 data model. Since a node may have a list-valued data type, the typed value is in general a sequence, and it is returned in the form of a SequenceIterator.
If the node has not been validated against a schema, the typed value will be the same as the string value, either as an instance of xs:string or as an instance of xdt:untypedAtomic, depending on the node kind.
For an atomic value, this method returns an iterator over a singleton sequence containing the atomic value itself.
- Returns:
- an iterator over the items in the typed value of the node or atomic value. The items returned by this iterator will always be atomic values.
- Throws:
XPathException
- where no typed value is available, for example in the case of an element with complex content- Since:
- 8.4
-