public class SaxonXQSequence extends Closable implements XQResultSequence, SaxonXQItemAccessor
Modifier and Type | Method and Description |
---|---|
boolean |
absolute(int itempos)
Moves the
XQSequence 's position to the given item
number in this object. |
void |
afterLast()
Move to the position after the last item.
|
void |
beforeFirst()
Moves to the position before the first item.
|
int |
count()
Returns a number indicating the number of items in the sequence.
|
boolean |
first()
Moves to the first item in the sequence.
|
java.lang.String |
getAtomicValue()
Gets the current item as a Java
String . |
boolean |
getBoolean()
Gets the current item as a
boolean . |
byte |
getByte()
Gets the current item as a
byte . |
XQConnection |
getConnection()
Gets the XQuery connection associated with this result sequence
|
double |
getDouble()
Gets the current item as a
double . |
float |
getFloat()
Gets the current item as a
float . |
int |
getInt()
Gets the current item as an
int . |
XQItem |
getItem()
Get the current item as an immutable
XQItem object. |
javax.xml.stream.XMLStreamReader |
getItemAsStream()
Read the current item as an
XMLStreamReader object, as described
in Section 12.1 Serializing an XDM instance into a StAX event stream
(XMLStreamReader), XQuery API for Java (XQJ) 1.0. |
java.lang.String |
getItemAsString(java.util.Properties props)
Serializes the current item according to the
XSLT 2.0 and XQuery 1.0 serialization.
|
XQItemType |
getItemType()
Gets the type of the item.
|
long |
getLong()
Gets the current item as a
long . |
org.w3c.dom.Node |
getNode()
Gets the item as a DOM node.
|
java.net.URI |
getNodeUri()
Returns the URI for this item.
|
java.lang.Object |
getObject()
Gets the current item as an
Object . |
int |
getPosition()
Gets the current cursor position.
|
Item |
getSaxonItem()
Get the current item, in the form of a Saxon Item object.
|
javax.xml.stream.XMLStreamReader |
getSequenceAsStream()
Read the entire sequence starting from the current position as an
XMLStreamReader object, as described in
Section 12.1 Serializing an XDM instance into a StAX event stream
(XMLStreamReader), XQuery API for Java (XQJ) 1.0. |
java.lang.String |
getSequenceAsString(java.util.Properties props)
Serializes the sequence starting from the current position to a String
according to the
XSLT 2.0 and XQuery 1.0 serialization.
|
short |
getShort()
Gets the current item as a
short . |
boolean |
instanceOf(XQItemType type)
Checks if the item "matches" an item type, as defined in
2.5.4.2
Matching an Item Type and an Item, XQuery 1.0: An XML Query Language.
|
boolean |
isAfterLast()
Checks if the current position is after the last item in the sequence.
|
boolean |
isBeforeFirst()
Checks if the current position before the first item in the sequence.
|
boolean |
isFirst()
Checks if the current position at the first item in the sequence.
|
boolean |
isLast()
Checks if the current position at the last item in the sequence.
|
boolean |
isOnItem()
Check if the sequence is positioned on an item or not.
|
boolean |
isScrollable()
Checks if the sequence is scrollable.
|
boolean |
last()
Moves to the last item in the sequence.
|
boolean |
next()
Moves to the next item in the sequence.
|
boolean |
previous()
Moves to the previous item in the sequence.
|
boolean |
relative(int itempos)
Moves the cursor a relative number of items, either positive or negative.
|
void |
writeItem(java.io.OutputStream os,
java.util.Properties props)
Serializes the current item to a
Writer according to
XSLT 2.0 and XQuery 1.0 serialization. |
void |
writeItem(java.io.Writer ow,
java.util.Properties props)
Serializes the current item to a
Writer according to
XSLT 2.0 and XQuery 1.0 serialization. |
void |
writeItemToResult(javax.xml.transform.Result result)
Writes the current item to a
Result . |
void |
writeItemToSAX(org.xml.sax.ContentHandler saxHandler)
Writes the current item to a SAX handler, as described in
in Section 12.2 Serializing an XDM instance into a SAX event stream,
XQuery API for Java (XQJ) 1.0.
|
void |
writeSequence(java.io.OutputStream os,
java.util.Properties props)
Serializes the sequence starting from the current position to an
OutputStream according to the
XSLT 2.0 and XQuery 1.0 serialization. |
void |
writeSequence(java.io.Writer ow,
java.util.Properties props)
Serializes the sequence starting from the current position to a Writer
according to the
XSLT 2.0 and XQuery 1.0 serialization.
|
void |
writeSequenceToResult(javax.xml.transform.Result result)
Writes the entire sequence starting from the current position to a
Result . |
void |
writeSequenceToSAX(org.xml.sax.ContentHandler saxHandler)
Writes the entire sequence starting from the current position to a SAX
handler, as described in Section 12.2 Serializing an XDM instance
into a SAX event stream, XQuery API for Java (XQJ) 1.0.
|
close, isClosed, setClosableContainer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, isClosed
public boolean absolute(int itempos) throws XQException
XQSequence
XQSequence
's position to the given item
number in this object. If the item number is positive, the
XQSequence
moves to the given item number with
respect to the beginning of the XQSequence
. The first item is item 1, the second is item 2, and so on.
If the given item number is negative, the XQSequence
positions itself on an absolute item position with respect to the
end of the sequence.
absolute(-1)
positions the XQSequence
on the last item;
calling the method absolute(-2)
moves the
XQSequence
to the next-to-last item, and so on.
absolute(0)
will position the sequence before the first item.
An attempt to position the sequence beyond the first/last item
set leaves the current position to be before the first item or
after the last item. Calling this method on an empty sequence will return
false
.absolute
in interface XQSequence
itempos
- the item position to jump totrue
if the current position is
within the sequence, false
otherwiseXQException
- if (1) the sequence is forward only, or
(2) the sequence is in a closed statepublic void afterLast() throws XQException
XQSequence
afterLast
in interface XQSequence
XQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic void beforeFirst() throws XQException
XQSequence
beforeFirst
in interface XQSequence
XQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic int count() throws XQException
XQSequence
count
in interface XQSequence
XQException
- if (1) the sequence is forward-only, or (2)
the sequence is closedpublic boolean first() throws XQException
XQSequence
true
, if it was able to move to the first item in the sequence
false
, otherwise. Calling this method on an empty sequence
will return false
.first
in interface XQSequence
true
if the sequence was positioned
on the first item, false
otherwiseXQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic XQItem getItem() throws XQException
XQSequence
XQItem
object.
In case of an XQResultSequence
, the item is an
XQResultItem
.
In the case of forward only sequences, this method or any other
get or write method may only be called once on the curent item. The
XQItem
object is dependent on the sequence from which
it was created and is only valid for the duration of XQSequence
lifetime. Thus, the XQSequence
is closed, this XQItem
object will be implicitly closed and it can no longer be used.getItem
in interface XQSequence
XQItem
objectXQException
- if (1) there are errors retrieving the item,
or (2) in the case of a forward only sequence,
a get or write method has already been invoked
on the current item.public Item getSaxonItem()
SaxonXQItemAccessor
NodeInfo
or AtomicValue
.getSaxonItem
in interface SaxonXQItemAccessor
public int getPosition() throws XQException
XQSequence
0 indicates that the position is before the first item
and count() + 1
indicates position after the last item.
A specific position indicates that the cursor is positioned on
the item at that position. Use the isOnItem
method to verify if the cursor is positioned on the item.
Calling this method on an empty sequence will return
0
.getPosition
in interface XQSequence
XQException
- if (1) the sequence is forward-only, or (2)
the sequence is closedpublic javax.xml.stream.XMLStreamReader getSequenceAsStream() throws XQException
XQSequence
XMLStreamReader
object, as described in
Section 12.1 Serializing an XDM instance into a StAX event stream
(XMLStreamReader), XQuery API for Java (XQJ) 1.0.
Note that the serialization process might fail, in which case a
XQException
is thrown.
While the stream is being read, the application MUST NOT do any other
concurrent operations on the sequence. The operation on the stream is
undefined if the underlying sequence position or state is changed by
concurrent operations.
After all items are written to the stream, the current position of the
cursor is set to point after the last item.
Also, in the case of forward only sequences, this method may only be
called if the current item has not yet been read through any of the get
or write methods.getSequenceAsStream
in interface XQSequence
XMLStreamReader
XQException
- if (1) there are errors accessing any of the items
in the sequence, (2) the sequence is in a closed state,
(3) in the case of a forward only sequence, a get or write
method has already been invoked on the current item, or
(4) in case of an error during serialization of the sequence
into a StAX event stream as defined in Section 12.1
Serializing an XDM instance into a StAX event stream
(XMLStreamReader), XQuery API for Java (XQJ) 1.0public java.lang.String getSequenceAsString(java.util.Properties props) throws XQException
XQSequence
getSequenceAsString
in interface XQSequence
props
- specifies the serialization parameters,
null
is considered equivalent to an
empty Properties
objectXQException
- if (1) there are errors accessing the items in
the sequence, (2) there are errors
during serialization, (3) the sequence is in a closed state,
or (4) in the case of a forward only sequence, a get or
write method has already been invoked on the current itempublic boolean isAfterLast() throws XQException
XQSequence
false
.isAfterLast
in interface XQSequence
true
if the current position is
after the last item, false
otherwiseXQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic boolean isBeforeFirst() throws XQException
XQSequence
false
.isBeforeFirst
in interface XQSequence
true
if the current position is
before the first item, false
otherwiseXQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic boolean isFirst() throws XQException
XQSequence
false
.isFirst
in interface XQSequence
true
if the current position is at
the first item, false
otherwiseXQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic boolean isLast() throws XQException
XQSequence
false
.isLast
in interface XQSequence
true
if the current position is at
the last item, false
otherwiseXQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic boolean isOnItem() throws XQException
XQSequence
false
.isOnItem
in interface XQSequence
true
if the sequence is currently
positioned on an item, false
if sequence
is positioned before the first item, or after the last
itemXQException
- if the sequence is in a closed statepublic boolean isScrollable() throws XQException
XQSequence
isScrollable
in interface XQSequence
true
if the sequence can be scrolled
backward or forward, false
otherwiseXQException
- if the sequence is in a closed statepublic boolean last() throws XQException
XQSequence
true
, if it was able to move to the last item in the sequence
false
, otherwise. Calling this method on an empty sequence
will return false
.last
in interface XQSequence
true
if the sequence was positioned
on the last item, false
otherwiseXQException
- if (1) the sequence is forward only,
or (2) the sequence is in a closed statepublic boolean next() throws XQException
XQSequence
false
.next
in interface XQSequence
true
if the new item is valid,
false
if there are no more itemsXQException
- if the sequence is in a closed statepublic boolean previous() throws XQException
XQSequence
false
.previous
in interface XQSequence
true
if the new current position is
within the sequence, (i.e., not before first);
false
otherwise.XQException
- if (1) the sequence is forward only, or
(2) the sequence is in a closed state.public boolean relative(int itempos) throws XQException
XQSequence
relative(0)
is valid, but does not change the cursor position.
Note: Calling the method relative(1)
is identical to calling the method
next
and calling the method relative(-1)
is identical
to calling the method previous()
.
Calling this method on an empty sequence will return false
.relative
in interface XQSequence
itempos
- the item position to jump totrue
if the new current position is within
the sequence (i.e., not before first or after last);
false
otherwise.XQException
- if (1) the sequence is forward only, or
(2) the sequence is in a closed state.public void writeSequence(java.io.OutputStream os, java.util.Properties props) throws XQException
XQSequence
OutputStream
according to the
XSLT 2.0 and XQuery 1.0 serialization.
Serialization parameters, which influence how serialization is
performed, can be specified. Refer to the
XSLT 2.0 and XQuery 1.0 serialization
and Section 12 Serialization, XQuery
API for Java (XQJ) 1.0 for more information.
Reading the sequence during the serialization process performs implicit
next operations to read the items.
After all items are written to the stream, the current position of the
cursor is set to point after the last item.
Also, in the case of forward only sequences, this method may only be
called if the current item has not yet been read through any of the
get or write methods.writeSequence
in interface XQSequence
os
- the output stream into which the sequence is to be serializedprops
- specifies the serialization parameters,
null
is considered equivalent to an empty
Properties
objectXQException
- if (1) there are errors accessing the items in
the sequence, (2) there are errors
during serialization, (3) the sequence is in a closed state,
(4) in the case of a forward only sequence, a get or
write method has already been invoked on the current item,
or (5) the os
parameter is null
public void writeSequence(java.io.Writer ow, java.util.Properties props) throws XQException
XQSequence
Writer
, make sure the writer's encoding
matches the encoding parameter if specified as a property or the default
encoding.
writeSequence
in interface XQSequence
ow
- the writer object into which the sequence is to be serializedprops
- specifies the serialization parameters,
null
is considered equivalent to an empty
Properties
objectXQException
- if (1) there are errors accessing the items in
the sequence, (2) there are errors during serialization,
(3) the sequence is in a closed state,
(4) in the case of a forward only sequence, a get or
write method has already been invoked on the current item,
or (5) the ow
parameter is null
public void writeSequenceToResult(javax.xml.transform.Result result) throws XQException
XQSequence
Result
. First the sequence is normalized as described in
XSLT 2.0 and XQuery 1.0 serialization. Subsequently it is serialized
to the Result
object.XQException
is thrown.
An XQJ implementation must at least support the following
implementations:
javax.xml.transform.dom.DOMResult
javax.xml.transform.sax.SAXResult
javax.xml.transform.stream.StreamResult
writeSequenceToResult
in interface XQSequence
result
- the result object into which the sequence
is to be serializedXQException
- if (1) there are errors accessing any of the items
in the sequence, (2) the sequence is in a closed
state, (3) in the case of a forward only sequence, a get or
write method has already been invoked on the current item,
(4) in case of an error while serializing the sequence
into the Result
object, or (5) the
result
parameter is null
public void writeSequenceToSAX(org.xml.sax.ContentHandler saxHandler) throws XQException
XQSequence
XQException
is thrown.
After all items are written to the stream, the current position of the
cursor is set to point after the last item.
Also, in the case of forward only sequences, this method may only be called
if the current item has not yet been read through any of the get or write
methods.
The specified org.xml.sax.ContentHandler
can optionally implement the
org.xml.sax.LexicalHandler
interface. An implementation must check if the
specified ContentHandler
implements LexicalHandler
.
If the handler is a LexicalHandler
comment nodes are reported, otherwise
they will be silently ignored.writeSequenceToSAX
in interface XQSequence
saxHandler
- the SAX content handler, optionally a lexical handlerXQException
- if (1) there are errors accessing any of the items
in the sequence, (2) the sequence is in a closed
state, (3) in the case of a forward only sequence, a get or
write method has already been invoked on the current item,
(4) in case of an error during serializing the XDM instance
into a SAX event stream, or (5) the saxhdlr
parameter is null
public java.lang.String getAtomicValue() throws XQException
XQItemAccessor
String
. The current item
must be an atomic value. This function casts the current item to an
xs:string
value according to the casting rules defined in
17.1.2 Casting to xs:string and xs:untypedAtomic, XQuery 1.0 and
XPath 2.0 Functions and Operators,
and then returns the value as a Java String
.getAtomicValue
in interface XQItemAccessor
XQException
- if (1) there are errors accessing the item's value,
(2) the item is not an atomic value,
(3) there is an error when casting the
item to a string representation,
(4) the underlying sequence or item is in a
closed state, or (5) in the case of forward only
sequences, a get or write method was already
invoked on the current itempublic boolean getBoolean() throws XQException
XQItemAccessor
boolean
.
The current item must be an atomic value of type xs:boolean
or a subtype.getBoolean
in interface XQItemAccessor
boolean
representing the current itemXQException
- if (1) the conversion of the current item to a
boolean
fails, (2) if there are
errors accessing the current item, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic byte getByte() throws XQException
XQItemAccessor
byte
.
The current item must be an atomic value of type xs:decimal
or a subtype, and its value must be in the value space of byte
.getByte
in interface XQItemAccessor
byte
representing the current itemXQException
- if (1) the conversion of the current item to a
byte
fails, (2) if there are
errors accessing the current item, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic double getDouble() throws XQException
XQItemAccessor
double
.
The current item must be an atomic value of type xs:double
or a subtype.getDouble
in interface XQItemAccessor
double
representing the current itemXQException
- if (1) the conversion of the current item to a
double
fails, (2) if there are
errors accessing the current item, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic float getFloat() throws XQException
XQItemAccessor
float
.
The current item must be an atomic value of type xs:float
or a subtype.getFloat
in interface XQItemAccessor
float
representing the current itemXQException
- if (1) the conversion of the current item to a
float
fails, (2) if there are
errors accessing the current item, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic int getInt() throws XQException
XQItemAccessor
int
.
The current item must be an atomic value of type xs:decimal
or a subtype, and its value must be in the value space of int
.getInt
in interface XQItemAccessor
int
representing the current itemXQException
- if (1) the conversion of the current item to a
int
fails, (2) if there are
errors accessing the current item, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic javax.xml.stream.XMLStreamReader getItemAsStream() throws XQException
XQItemAccessor
XMLStreamReader
object, as described
in Section 12.1 Serializing an XDM instance into a StAX event stream
(XMLStreamReader), XQuery API for Java (XQJ) 1.0.
Note that the serialization process might fail, in which case a
XQException
is thrown.
While the stream is being read, the application MUST NOT do any other
concurrent operations on the underlying item or sequence.
The operation on the stream is undefined if the underlying sequence
is repositioned or the state of the underlying item or sequence
is changed by concurrent operations.getItemAsStream
in interface XQItemAccessor
XMLStreamReader
XQException
- if (1) there are errors accessing the current item
or the underlying sequence, (2) the underlying sequence
or item is in a closed state, (3) in the case of a forward
only sequence, a get or write method has already been
invoked on the current item, or (4) in case of an error
during serialization of the current item into a StAX event
stream as defined in Section 12.1 Serializing an XDM
instance into a StAX event stream (XMLStreamReader), XQuery
API for Java (XQJ) 1.0public java.lang.String getItemAsString(java.util.Properties props) throws XQException
XQItemAccessor
getItemAsString
in interface XQItemAccessor
props
- specifies the serialization parameters,
null
is considered equivalent to an empty
Properties
objectXQException
- if (1) there are errors accessing the current
item or the underlying sequence, (2) the underlying
sequence or item is in a closed state,
(3) in the case of a forward only sequence,
a get or write method has already been
invoked on the current item, or (4)
if there are errors during serializationpublic XQItemType getItemType() throws XQException
XQItemAccessor
getItemType
in interface XQItemAccessor
XQException
- if (1) there are errors accessing the type of the item,
or (2) the underlying sequence or item is in a closed statepublic long getLong() throws XQException
XQItemAccessor
long
.
The current item must be an atomic value of type xs:decimal
or a subtype, and its value must be in the value space of long
.getLong
in interface XQItemAccessor
long
representing the current itemXQException
- if (1) the conversion of the current item to a
long
fails, (2) if there are
errors accessing the current item, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic org.w3c.dom.Node getNode() throws XQException
XQItemAccessor
getNode
in interface XQItemAccessor
XQException
- if (1) if there are errors accessing the current item,
(2) the current item is not a node, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic java.net.URI getNodeUri() throws XQException
XQItemAccessor
fn:document-uri
were evaluated on this document
node. If the item is of a node kind other than document node, then the
returned URI is implementation-defined.getNodeUri
in interface XQItemAccessor
XQException
- if (1) if there are errors accessing the current item,
(2) the current item is not a node, (3) if the
underlying sequence or item is in a closed statepublic java.lang.Object getObject() throws XQException
XQItemAccessor
Object
.
The data type of the returned object will be the Java Object
type as specified in 14.4 Mapping an XQuery Atomic Value to a
Java Object Type and 14.5 Mapping an XQuery Node to a Java Object Type,
XQuery API for Java (XQJ) 1.0.getObject
in interface XQItemAccessor
XQException
- if (1) if there are errors accessing the current item,
(2) if the underlying sequence or item is in a closed state,
or (3) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic short getShort() throws XQException
XQItemAccessor
short
.
The current item must be an atomic value of type xs:decimal
or a subtype, and its value must be in the value space of short
.getShort
in interface XQItemAccessor
short
representing the current itemXQException
- if (1) the conversion of the current item to a
short
fails, (2) if there are
errors accessing the current item, (3) if the
underlying sequence or item is in a closed state,
or (4) in the case of forward only sequences, a
get or write method was already invoked on the
current itempublic boolean instanceOf(XQItemType type) throws XQException
XQItemAccessor
... XQItemType strType = conn.createAtomicType(XQItemType.XQBASETYPE_STRING); XQItemType nodeType = conn.createNodeType(); XQSequence result = preparedExpr.executeQuery(); while (result.next()) { // Generic check for node.. if (result.instanceOf(nodeType)) org.w3.dom.Node node = result.getNode(); else if (result.instanceOf(strType)) String str = result.getAtomicValue(); }
XQItemAccessor
or the input
XQItemType
is not a built-in type, then this method is
allowed to raise exception if it can NOT determine the instanceOf
relationship due to the lack of the access of
the XML schema that defines the user defined schema types if the
XQMetaData.isUserDefinedXMLSchemaTypeSupported()
method
returns false
.
XQItemAccessor
is an instance of the input
XQItemType
. Note even if
isUserDefinedXMLSchemaTypeSupported()
returns false
,
an XQJ implementation may still be able to determine the instanceOf
relationship for certain cases involving user defined schema type.
For example, if the type of an XQItemAccessor
is of
mySchema:hatSize
sequence type and the input parameter
XQItemType
is of item()
sequence type,
the return value for instanceOf relationship should always be true
even though the XQJ implementation does not know the precise type
information of mySchema:hatSize
type defined in XML
schema 'mySchema'
.instanceOf
in interface XQItemAccessor
type
- item type to matchtrue
if this item matches
the input item type as defined in
2.5.4.2 Matching an Item Type and an Item,
XQuery 1.0: An XML Query Language,
and false
if it does notXQException
- if (1) there are errors accessing the item's
type, (2) if the underlying sequence or item
is in a closed state, (3) if the implementation
is unable to determine the schema definition of a
user defined schema type, or (4) the type
parameter is null
public void writeItem(java.io.OutputStream os, java.util.Properties props) throws XQException
XQItemAccessor
Writer
according to
XSLT 2.0 and XQuery 1.0 serialization.
Serialization parameters, which influence how serialization is
performed, can be specified. Refer to the
XSLT 2.0 and XQuery 1.0 serialization
and Section 12 Serialization, XQuery
API for Java (XQJ) 1.0 for more information.writeItem
in interface XQItemAccessor
os
- the output stream into which the current item is
to be serializedprops
- specifies the serialization parameters,
null
is considered equivalent to an empty
Properties
objectXQException
- if (1) there are errors accessing the current
item or the underlying sequence, (2) the underlying
sequence or item is in a closed state,
(3) in the case of a forward only sequence, a get or
write method has already been invoked on the current item,
(4) if there are errors during serialization, or
(5) the os
parameter is null
public void writeItem(java.io.Writer ow, java.util.Properties props) throws XQException
XQItemAccessor
Writer
according to
XSLT 2.0 and XQuery 1.0 serialization.
Serialization parameters, which influence how serialization is
performed, can be specified. Refer to the
XSLT 2.0 and XQuery 1.0 serialization
and Section 12 Serialization, XQuery
API for Java (XQJ) 1.0 for more information.
Writer
, make sure the writer's encoding
matches the encoding parameter if specified as a property or the default
encoding.writeItem
in interface XQItemAccessor
ow
- the writer object into which the current item is to be
serializedprops
- specifies the serialization parameters,
null
is considered equivalent to an empty
Properties
objectXQException
- if (1) there are errors accessing the current
item or the underlying sequence, (2) the underlying
sequence or item is in a closed state,
(3) in the case of a forward only sequence, a get or
write method has already been invoked on the current item,
(4) if there are errors during serialization, or
(5) the ow
parameter is null
public void writeItemToResult(javax.xml.transform.Result result) throws XQException
XQItemAccessor
Result
. First the item is
normalized as described in
XSLT 2.0 and XQuery 1.0 serialization. Subsequently it is
serialized to the Result
object.XQException
is thrown.
An XQJ implementation must at least support the following implementations:
javax.xml.transform.dom.DOMResult
javax.xml.transform.sax.SAXResult
javax.xml.transform.stream.StreamResult
writeItemToResult
in interface XQItemAccessor
result
- the result object into which the item is to be serializedXQException
- if (1) there are errors accessing the current
item or the underlying sequence, (2) the underlying
sequence or item is in a closed state, (3) in the case
of a forward only sequence, a get or write method has
already been invoked on the current item, (4) in case
of an error while serializing the current item into the
Result
object, or (5) the result
parameter is null
public void writeItemToSAX(org.xml.sax.ContentHandler saxHandler) throws XQException
XQItemAccessor
XQException
is thrown.
The specified org.xml.sax.ContentHandler
can optionally implement the
org.xml.sax.LexicalHandler
interface. An implementation must check if the
specified ContentHandler
implements LexicalHandler
.
If the handler is a LexicalHandler
comment nodes are reported, otherwise
they will be silently ignored.writeItemToSAX
in interface XQItemAccessor
saxHandler
- the SAX content handler, optionally a lexical handlerXQException
- if (1) there are errors accessing the current
item or the underlying sequence, (2) the underlying
sequence or item is in a closed state, (3) in the case
of a forward only sequence, a get or write method has
already been invoked on the current item, (4) in case
of an error while serializing the XDM instance
into a SAX event stream, or (5) the saxhdlr
parameter is null
public XQConnection getConnection() throws XQException
XQResultSequence
getConnection
in interface XQResultSequence
XQException
- if the result sequence is in a closed stateCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.