#3 Cannot read external variables, context item

closed-fixed
nobody
None
5
2011-05-03
2009-05-11
hrennau
No

Probably I just fail to understand the documentation - at any rate I have problems with specifying context item and external variables via command line API.
Thank you in advance for any help!
With kind regards,
Hans-Juergen Rennau

a) context item
Call:
java -jar ~/bin/mxquery-0.6/mxquery.jar -e ".:=cities.xml" -f q1.xq

Query q1:
.

Result:
Error message: Error creating validating input: org.xml.sax.SAXParseException: Content is not allowed in prolog.

b) external variable

Call:
java -jar ~/bin/mxquery-0.6/mxquery.jar -e "infile:=cities.xml" -f q2.xq

Query q2.xq:
declare variable $infile as xs:untypedAtomic external;
doc($infile)

Result:
Error message: Error creating validating input: org.xml.sax.SAXParseException: Content is not allowed in prolog.

Inputfile cities.xml:
<cities>
<city>London</city>
<city>Paris</city>
<city>Prague</city>
</cities>

Discussion

    • status: open --> closed-fixed
     
  • Closing this old report:
    - a) is a misunderstanding of the documentation
    := treat input as literal
    = treat input as file name

    so it should be -e ".=cities.xml"

    b) same issue + limitation of MXQuery 0.6.0: we always treat the input as XML document, thus parsing it. In the SVN trunk (rev 4306), we now detect if the external variable is of atomic type, and pass it on as an untyped atomic