CentraSite Documentation : CentraSite Developer’s Guide : API for XQJ : Working with the XQJ Interface : Working with a Materialized XQSequence : Examples
Examples
Creating a Sequence
This example demonstrates how to create a materialized sequence from Java collection via the java.util.iterator interface. It creates a materialized sequence holding 3 int items.
ArrayList items = new ArrayList();
items.add(conn.createItemFromInt(123,null));
items.add(conn.createItemFromInt(456,null));
items.add(conn.createItemFromInt(789,null));
XQSequence sequence = conn.createSequence(items.iterator());
Creating a Copy from an XQResultSequence
This example demonstrates how an XQResultSequence can be copied into a materialized sequence. The materialized sequence will exist independently of the XQResultSequence.
String query = "for $q in input()/bib/book where $q/@year = 1994 return $q";
XQExpression expression = connection.createExpression();
XQResultSequence resultSequence = expression.executeQuery(query);
 
XQSequence Sequence = connection.createSequence(resultSequence);
Copyright © Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback