executeQuery on XML, NOT stored on filesystem

Hi,

Is there any way to execute a query on an XML document that is stored in a “String” or a “Document”, not in a file? I have a java application that manipulates XML documents, but the documents are not stored in any file on the file system they are just manipulated internally to the application. I would like to use QuiP to execute a query on such a document, but it would be “compilicated” to have to save the document to a file just so I can execute the query. Is there any more direct way in which I could do this?

Thank you,
Mari

Hi,

if you are using Java anyway, why not try calling a Java function from Quip to return the XML string? This is possible in 2.2.1.1. Examples are provided.

Regards Udo

Hmm, I don’t think that I understand very well. With Java function calls, you have to write your own java function that afterwards you can call from Quip. Right? What I need is just to execute a query on an XML document using the QuiP executeQuery() method. I would like to write an XQuery, and use executeQuery() to get the result. The problem is that I can use executeQuery() only if my XML doc is stored in a file.

Can you maybe tell me a bit more what Java function I could write to accomplish this? I did look in the examples/javaCalls …

Thank you,
Mari

hello!
I know an XQuery which does not use a sample document but node sequence:

for $p := (, , )
return

{$p}


I think maybe you can generate a string of node sequence in your java program, and then execute it later. hope that helps.

let $p := (…)

Thanks, but it’s not exactly what I need :slight_smile:

I understand you have a Java method returning XML (as an Element). If this method is exposed statically, you should be able to call it from your query in the same way as the Java method “parseFileAsXml” is called in the javaCalls.xquery example.
This example function parses an input stream, but it could just as well create its result synthentically like in your case.

Regards Udo