Okay, I thought that this error came from XQuery. I did not notice before that XQuery can operate on invalid XML document.
Thanks. In fact I can save the response and the body in two different files.
On Thu, Jun 7, 2012 at 10:50 AM, Christian Grün christian.gruen@gmail.com wrote:
But using the CLI with an xml with two elements give me an error
$ echo "<a></a><b></b>" | java -cp basex.jar org.basex.BaseX -i - -q".[2]" "1339078766196.xml" (Line 1): No elements allowed after closed root element.
This is acatually not the fault of the CLI; the -i flag expects a valid XML document as input, and "<a></a><b></b>" does not meet these requirements. It would probably be difficult to extend -i to accept any kind of input, because there are numerous cases in which XQuery results are ambiguous.
What about storing only the actual result of http:send-request in your file? Christian
On Thu, Jun 7, 2012 at 10:26 AM, Philippe Rathé prathe@gmail.com wrote:
Christian,
thanks. In fact this path expression work in the context of XQuery code.
http:send-request(...)[2]
But using the CLI with an xml with two elements give me an error
$ echo "<a></a><b></b>" | java -cp basex.jar org.basex.BaseX -i - -q".[2]" "1339078766196.xml" (Line 1): No elements allowed after closed root element.
I have the error even when I use the -i option with an xml file having two elements. My intention was to save the http:send-request output to a file and process it later with a CLI.
Is it the intented behavior of the CLI?
On Wed, Jun 6, 2012 at 6:20 AM, Christian Grün christian.gruen@gmail.com wrote:
I'm using the HTTP Module[1] for sending request. The response has he http:response element which is XML. Then at the end of that element is the body of the response.
http:send-request() will return two items. You can access the second one (the actual result) with a positional predicate:
http:send-request(...)[2]