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

RE: Totally non-conformant JSON hack

From: David Lee <dlee@calldei.com>
Date: Mon, 10 Oct 2011 10:10:42 -0400
To: "'Norman Walsh'" <ndw@nwalsh.com>, "'XProc Dev'" <xproc-dev@w3.org>
Message-ID: <00bf01cc8756$65d0c620$31725260$@calldei.com>
Not worried about niceness or elegance ... but am concerned about using a
'convention' that will have some lifetime.
Have you considered JSONx which is (has been?) introduced to the public
domain (after being patented by IBM) ?

Its not my favorite but it has some backing ...
Then there *is* my favorite  (JXML which has no backing) but does model the
JSON data model more directly then JSONx


Any model that is lossless is fine but It is beginning to concern me the
proliferation of lossless JSON/XML models.

It would be nice if the community could narrow down rather then proliferate
on if not a 'standard' atleast a 'common' way of translating JSON to XML in
a lossless format.

David A. Lee

-----Original Message-----
From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On Behalf
Of Norman Walsh
Sent: Monday, October 10, 2011 9:19 AM
To: XProc Dev
Subject: Re: Totally non-conformant JSON hack

David Lee <dlee@calldei.com> writes:

> I must have missed this "conformant" XML-JSON mapping.

It's conformant for p:unescape-markup to convert JSON to XML because the
spec says

  An implementation may use a different parser to produce XML content
  depending on the specified content-type. For example, an
  implementation might provide an HTML to XHTML parser (e.g. [HTML
  Tidy] or [TagSoup]) for the content type 'text/html'.

For the content type "application/json", I use a parser that produces XML
like this:

<c:json xmlns:c="http://www.w3.org/ns/xproc-step" type="object">
   <c:pair name="id" type="string">1180513108190941...</c:pair>
   <c:pair name="nullvalue" type="null"/>
   <c:pair name="image" type="object">
      <c:pair name="url" type="string">https://...</c:pair>
   <c:pair name="boolean" type="boolean">false</c:pair>
   <c:pair name="displayName" type="string">John Doe</c:pair>
   <c:pair name="kind" type="string">plus#person</c:pair>
   <c:pair name="url" type="string">https://...</c:pair>
   <c:pair name="array" type="array">
      <c:item type="number">1</c:item>
      <c:item type="number">2</c:item>
      <c:item type="number">3</c:item>

There's nothing particularly elegant or nice about that markup, but
the first reasonable Java library I found produced it. And it does
have the benefits of being regular and handling arbitrary names.

I'm open to suggestions for better vocabularies, I suppose.

                                        Be seeing you,

Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
Received on Monday, 10 October 2011 14:11:19 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:09 UTC