Your still sending a 'string'
Use this instead.
String xmlString = "<element><child/></element>"
InputStream is = new ByteArrayInputStream( xmlString.toBytes("UTF-8"));
com.marklogic.xcc.types.XdmValue value = ValueFactory.newElement(is);
From: [email protected]
[mailto:[email protected]] On Behalf Of Dave Liepmann
Sent: Friday, July 29, 2016 7:20 AM
To: [email protected]
Subject: [MarkLogic Dev General] External variables as element() type
Hi MarkLogic folks!
I'd like to pass an XML element as an external variable to my query using
MarkLogic XCC/J and have it be recognized as type element() when it arrives in
XQuery.
I set my-variable to "<foo/>" (or "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><foo></foo>", no difference) using setNewVariable on the
Request, with "element()" for the ValueType. Then:
xquery version \"1.0-ml\";
declare variable $my-variable as element() external;
xdmp:type(xdmp:unquote($my-variable))
This returns "untypedAtomic". Is this expected behavior? I'd like to see it
come through typed as an element(). Is there a better way, either in XQuery or
in the Request, to set the type of an external variable?
Thanks in advance,
Dave Liepmann
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general