W3C home > Mailing lists > Public > xproc-dev@w3.org > October 2011

Re: Totally non-conformant JSON hack

From: Norman Walsh <ndw@nwalsh.com>
Date: Mon, 10 Oct 2011 14:50:24 -0400
To: XProc Dev <xproc-dev@w3.org>
Message-ID: <m2obxoadfz.fsf@nwalsh.com>
David Lee <dlee@calldei.com> writes:
> Thanks, I'm going to start moving to this as well in xmlsh and JXON 
>
> The fewer "standards" doing exactly the same thing the better.

After some more thought over lunch, I think I may just make it
user-configurable. I have five variations in mind and it's not clear
that one is uniformly superior to all the others:

1. My own hack w/o a namespace (deprecated)
2. My own hack in the XProc step namespace
3. JSONx
4. JXON
5. An element-name based syntax with some escaping:

<j:json xmlns:j="http://marklogic.com/json" type="object">
   <j:id type="string">118051310819094153327</j:id>
   <j:_ type="string">empty string</j:_>
   <j:_0031foo_0024bar type="string">1foo$bar</j:_0031foo_0024bar>
   <j:x_003ahtml type="string">x:html</j:x_003ahtml>
   <j:nullvalue type="null"/>
   <j:foo_0024bar type="string">foo$bar</j:foo_0024bar>
   <j:image type="object">
      <j:url type="string">https://lh5.googleusercontent.com/-XnZDEoiF09Y/AAAAAAAAAAI/AAAAAAAAYCI/7fow4a2UTMU/photo.jpg</j:url>
   </j:image>
   <j:boolean type="boolean">false</j:boolean>
   <j:displayName type="string">Chirag Shah</j:displayName>
   <j:url type="string">https://plus.google.com/118051310819094153327</j:url>
   <j:kind type="string">plus#person</j:kind>
   <j:array type="array">
      <j:item type="number">1</j:item>
      <j:item type="number">2</j:item>
      <j:item type="number">3</j:item>
   </j:array>
</j:json>

This one happens to work really well in an environment where you've got
an index on element names :-)

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Monday, 10 October 2011 18:50:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 10 October 2011 18:50:59 GMT