So, the answer to my question is "No" - you're unaware of whether anyone 
developed a method (utility?) of converting a XML Schema into custom strategy.

Thanks anyway.

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Geert Josten
Sent: Thursday, April 13, 2017 10:22 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] json:config for XML schema


*** External email: use caution ***


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: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of Florent Georges <li...@fgeorges.org<mailto:li...@fgeorges.org>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Thursday, April 13, 2017 at 4:08 PM
To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
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:general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 
[mailto:general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>]
 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: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of "Steiner, David J. (LNG-DAY)" 
<david.j.stei...@elsevier.com<mailto:david.j.stei...@elsevier.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Thursday, April 13, 2017 at 3:18 PM
To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
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
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general




_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to