Java APIP: XQueryException:XQueryDocument

Hi,

I wrote a very simple java application using QuiP. I have a xml document stored in my local filesystem called"bib.xml", and I’m trying to execute a query. I get an exception, but no info in the Exception telling me what the problem might be. I’m thinking that it’s possible that either the xml doc or the query that I’m trying to execute are not correct. Any help would be greatly appreciated.

Thank you,
Maria

The sample code is:
// create a QuiP connection
Properties obj = new Properties();
obj.put(“home”,“C:\quip161\QuiP\”);
obj.put(“quipcmd”,“C:\quip161\QuiP\quip.exe” );

StringBuffer file = new StringBuffer();
file.append(“file://.”);
QuiPConnection qc = new QuiPConnection(file.toString(), obj);
// execute query
QueryResult qr = qc.executeQuery(query);
Document result = qr.getDocument();

The example document is:


TCP/IP Illustrated

Stevens
W.

Addison-Wesley
65.95

The example query is:
FOR $book IN document(“bib.xml”)//book WHERE $book/publisher = “Addison-Wesley” RETURN $book/title

And the Exception that I get is:
com.softwareag.xtools.quip.xqueryAPI.XQueryException: org/apache/crimson/tr
ee/XmlDocument

at com.softwareag.xtools.quip.xqueryAPI.QuiPConnection.executeQuery
(QuiPConnection.java:72)
at OpXquery.processTuple(OpXquery.java:242)
at OpXquery.on_in_rel(OpXquery.java:87)
at java.lang.reflect.Method.invoke(Native Method)
at theseus.executor.basic.BasicOperatorManager.invokeStreamingMetho
d(BasicOperatorManager.java:1081)
at theseus.executor.basic.BasicOperatorManager.processFiring(BasicO
peratorManager.java:843)
at theseus.executor.basic.BasicOperatorManager.handleEvent(BasicOpe
ratorManager.java:741)
at theseus.executor.basic.BasicOperatorManager.run(BasicOperatorMan
ager.java:1472)
at java.lang.Thread.run(Unknown Source)

Probably for some reason your query result is not
a document and therefore

Document result = qr.getDocument();

fails.

For a test try to make

try{
Document result = qr.getDocument();
}catch (Exception _){
System.out.println(gr.getRawString());
}

and you will see, what quip actually results in its textual form.

Sven Eric

I tried printing the raw string, but it doesn’t even get to produce the QueryResult. The Exception is thrown while executing :

QueryResult qr = qc.executeQuery(query);

My feeling is that ir “doesn’t like” the XmlDocument (the one that’s executing the query on), but I can’t figure out why.

Any other ideeas would be greatly appreciated :slight_smile:

Thanks a lot,
Maria

the error occurs even before any execution is started, but during parsing and transforming the
query into xqueryx format. This is done with the help of crimson dom implementation. Are you using
the crimson.jar file distributed with Quip or
another one? Then this might have to do with
different versions of crimson, which support
diggerent methods?