Yes exactly. The only safe way to convert mixed content using that json library is using the full config or custom config that specifies mixed elements for full conversion:
xquery version "1.0-ml"; import module namespace json="http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy"; let $xml := <p>hello <b>world</b> for the win!</p> let $config := json:config("full") let $_ := map:put($config, "full-element-names", "p") return json:transform-from-json(json:transform-to-json($xml, $config), $config) Cheers PS: nothing stops you from writing your own xml-json conversion lib though. Particularly xml 2 json should be fairly trivial with a bit of XSLT.. From: <[email protected]<mailto:[email protected]>> on behalf of Florent Georges <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Thursday, April 13, 2017 at 4:08 PM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] json:config for XML schema Hi, > JSON is ill-suited for hierarchical content. For the record, JSON is particularly bad at what we call "mixed content" in XML (what I guess Geert meant by "inline elements"). The idiomatic example of mixed content is the P element in HTML: it can contain text nodes as direct children, intermingled with other elements like B or EM or SPAN containing text nodes or other such elements themselves. Regards, -- Florent Georges H2O Consulting \http://h2o.consulting/ On 13 April 2017 at 15:55, Steiner, David J. (LNG-DAY) wrote: Hi Geert, Yes, I’ve looked at “full” – way too verbose and I’m very well aware of JSON is ill-suited for hierarchical content. Thanks, David From:[email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Geert Josten Sent: Thursday, April 13, 2017 9:47 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] json:config for XML schema Hi David, That sounds like a very large xsd. Keep in mind JSON is not very well suited for inline elements. I reckon you looked at the full strategy option of json:config? Rather verbose, but simple, and reliable roundtrip.. Cheers, Geert From: <[email protected]<mailto:[email protected]>> on behalf of "Steiner, David J. (LNG-DAY)" <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Thursday, April 13, 2017 at 3:18 PM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] json:config for XML schema Has anyone developed a method (utility?) of converting a XML Schema into custom strategy? I’ve briefly looked at xml4js but from what I gleaned, it seems like you have to go through and enter every import/include and I’m starting with 44 imports in the first xsd and each of those probably has imports as well. Thanks, David _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
