public class XdmValue extends java.lang.Object implements java.lang.Iterable<XdmItem>
An XdmValue is immutable.
A sequence consisting of a single item may be represented as an instance of XdmItem,
which is a subtype of XdmValue. However, there is no guarantee that a sequence of length one
will always be an instance of XdmItem.
Similarly, a zero-length sequence may be represented as an instance of XdmEmptySequence,
but there is no guarantee that every sequence of length zero will always be an instance of
XdmEmptySequence.
| Modifier | Constructor and Description |
|---|---|
protected |
XdmValue() |
|
XdmValue(java.lang.Iterable<? extends XdmItem> items)
Create an XdmValue as a sequence of XdmItem objects
|
protected |
XdmValue(Sequence value) |
|
XdmValue(XdmSequenceIterator iterator)
Create an XdmValue containing the items returned by an XdmSequenceIterator
|
| Modifier and Type | Method and Description |
|---|---|
XdmValue |
append(XdmValue otherValue)
Create a new XdmValue by concatenating the contents of this XdmValue and another
XdmValue into a single sequence.
|
Sequence |
getUnderlyingValue()
Get the underlying implementation object representing the value.
|
XdmItem |
itemAt(int n)
Get the n'th item in the value, counting from zero.
|
XdmSequenceIterator |
iterator()
Get an iterator over the items in this value.
|
static XdmValue |
makeSequence(java.lang.Iterable list)
Make an XDM sequence from a Java Iterable.
|
static XdmValue |
makeValue(java.lang.Object o)
Make an XDM value from a Java object.
|
protected void |
setValue(Sequence value) |
int |
size()
Get the number of items in the sequence
|
java.lang.String |
toString()
Create a string representation of the value.
|
static XdmValue |
wrap(Sequence value)
Create an XdmValue that wraps an existing Saxon Sequence
|
protected XdmValue()
public XdmValue(java.lang.Iterable<? extends XdmItem> items)
items - a sequence of XdmItem objects. Note that if this is supplied as a list or similar
collection, subsequent changes to the list/collection will have no effect on the XdmValue.public XdmValue(XdmSequenceIterator iterator) throws SaxonApiException
iterator - the iterator that supplies the valuesSaxonApiException - if an error occurs reading values from the supplied iteratorprotected XdmValue(Sequence value)
protected void setValue(Sequence value)
public static XdmValue wrap(Sequence value)
value - the supplied Sequence (which may be a singleton Item),SaxonApiUncheckedException - if the supplied Sequence is not yet fully evaluated, and evaluation
of the underlying expression fails with a dynamic error.public XdmValue append(XdmValue otherValue)
Note: creating a sequence of N values by successive calls on this method takes time proportional to N-squared.
otherValue - the value to be appendedpublic int size()
SaxonApiUncheckedException - if the value is lazily evaluated and the delayed
evaluation fails with a dynamic error.public XdmItem itemAt(int n) throws java.lang.IndexOutOfBoundsException, SaxonApiUncheckedException
n - the item that is required, counting the first item in the sequence as item zerojava.lang.IndexOutOfBoundsException - if n is less than zero or greater than or equal to the number
of items in the valueSaxonApiUncheckedException - if the value is lazily evaluated and the delayed
evaluation fails with a dynamic error.public XdmSequenceIterator iterator() throws SaxonApiUncheckedException
iterator in interface java.lang.Iterable<XdmItem>SaxonApiUncheckedException - if the value is lazily evaluated and the delayed
evaluation fails with a dynamic error.public Sequence getUnderlyingValue()
public java.lang.String toString()
toString in class java.lang.Objectpublic static XdmValue makeSequence(java.lang.Iterable list) throws java.lang.IllegalArgumentException
makeValue(Object) method;
if the result is anything other than a single XDM item, it is then wrapped in an
XdmArray.java.lang.IllegalArgumentException - if conversion is not possiblepublic static XdmValue makeValue(java.lang.Object o) throws java.lang.IllegalArgumentException
XdmValue (for example, an
XdmNode or XdmAtomicValue or XdmArray or XdmMap),
which is returned unchangedSequence (for example, a
NodeInfo or AtomicValue),
which is wrapped as an XdmValueMap, which is converted to an XDM Map using
the XdmMap.makeMap(java.util.Map) methodXdmArray.makeArray(java.lang.Object[]) methodIterable, which is converted to an XDM sequence
using the makeSequence(Iterable) methodXdmAtomicValue.makeAtomicValue(Object)java.lang.IllegalArgumentException - if conversion is not possibleCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.