9 Temmuz 2017 Pazar

XQPreparedExpression Arayüzü

Giriş
Şu satırı dahil ederiz.
import javax.xml.xquery.XQConnection;
import javax.xml.xquery.XQException;
import javax.xml.xquery.XQPreparedExpression;
import javax.xml.xquery.XQSequence;
Açıklaması şöyle
XPath is generally an easy way of extracting a portion of an XML doucment. I'd not recommend using it for processing all of an XML document.
executeQuery metodu
Şöyle yaparız.
OXQDataSource ds = new OXQDataSource();
XQConnection con = ds.getConnection();
String query = "<hello-world>{1 + 1}</hello-world>";
XQPreparedExpression expr = con.prepareExpression(query);
XQSequence result = expr.executeQuery();

// prints "<hello-world>2</hello-world>"
System.out.println(result.getSequenceAsString(null));

result.close();
expr.close();
con.close();

Hiç yorum yok:

Yorum Gönder