Hi Sini,
What you are doing makes me scratch my head in puzzlement.
transform-from-json without a custom configuration is really for JSON
documents. This is the transform that MarkLogic uses to store JSON
structures within the XML database.
The query object you have here started it's life as an XML structure,
which was transformed to JSON using a special custom configration. Your
transform back to XML is using a differnet method, so you don't end up
with the original XML at all.
I'm wondering why you do not simply manipulate the JSON that you already
have, rather than transforming it. If you include your $json-query
string, I can help to show you how to get the constraint names.
Also, tell us please where this JSON structure came from.
Charles
On 10/09/2013 04:07 AM, sini narayanan wrote:
Hi All,
I have a json query string and I performed
json:transform-from-json($json-query). I get the below output.
<json type="object" xmlns="http://marklogic.com/xdmp/json/basic">
<query type="object">
<and-query type="object">
<queries type="array">
<json type="object">
<range-constraint-query type="object">
<constraint-name type="string">country</constraint-name>
<value type="array">
<item type="string">FRA</item>
</value>
</range-constraint-query>
</json>
<json type="object">
<range-constraint-query type="object">
<constraint-name type="string">TravelType</constraint-name>
<value type="array">
<item type="string">TOURISM</item>
</value>
</range-constraint-query>
</json>
</queries>
</and-query>
</query>
</json>
How do I traverse through the output xml to get each constraint-name node.
I tried normal xpath on this output
json:transform-from-json($json-query)//constraint-name. But this
doesnot work.
Please help.
Thanks.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
--
Charles Greer
Senior Engineer
MarkLogic Corporation
[email protected]
Phone: +1 707 408 3277
www.marklogic.com
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general