xmlsh: 1.2.2
ml-xcc: 5.0.1
ml server: 5.0.3
java: 1.7.0_07
os x: 10.7.5

I have an xmlsh function that wraps an ML query. The ML query imports some
(xquery) library modules, then calls an xquery function.

The xmlsh function wraps ml:query -t -q "....$1"

So far, so good.

    my-func myfile.xml

works like a charm

I used the -t option in my query because myfile.xml includes a DOCTYPE
declaration which xmlsh complains about, and is irrelevant to me at this
point.

But I would like the XML as XML and run an xpath on it

So, I do a variety of things that don't work, but this works:

a=$(my-func myfile.xml |grep -v DOCTYPE)
b=<[$a]>
echo $b |xpath //my-tag

However, this does not work:

    xpath //my-tag <[ $(my-func myfile.xml |grep -v DOCTYPE) ]>

I get this error message, and then it hangs

[stdin line: 23]
Error expanding xml expression


Then, with ^?, I get:

stdin line: 24]
Exception running: xpath
org.xmlsh.core.CoreException: net.sf.saxon.s9api.SaxonApiException:
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 1; Content is
not allowed in prolog.

Nor, retreating to a less terse approach, does this work:

   xpath //xref <[ $a ]>

which hangs.

Not sure if there is a time-out, but for once, I got the following error
message (usually, I have to control-c out of the shell. Actually, it seems
like ^? gets me out gracefully with the error message).

[stdin line: 25]
Exception running: xpath
org.xmlsh.core.CoreException: net.sf.saxon.s9api.SaxonApiException:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is
not allowed in prolog.

So, a few questions:

What am I doing wrong?
What in the documentation have I not grasped that would have steered me
away from these errors?
Are there some remarks from a global perspective in the documentation that
would have helped avoid the traps I fell into.

Here's another issue:

Functions that I define do not seem able to invoke defined functions, even
if their declaration precedes their nested invocation.

That, and the errors I am encountering, suggest to me that there is some
limit on the recursive evaluation of the expressions you receive.

Thank you for any assistance you could offer, and thank you for xmlsh.


-- 
Nicholas Raphael
[email protected]
Software Development Manager
Senior Software Architect
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to