xsl-list
[Top] [All Lists]

Re: [xsl] XSLT functions for JSON

2008-05-18 07:04:42
On Sun, 2008-05-18 at 15:52 +0200, Jesper Tverskov wrote:


2. JSON has no way of handling even the most simple document oriented
XML structure like: "h2, p, h2, p" if the order matters as is likely
in the example. In JSON the order of the example will be changed to:
"h2, h2, p, p".

You can use an array to set order. This is a place where I wish FXSL
would be more like the (reference?) implementation org.json's java
library where when an object  or array is encountered in the JSON, the
resulting XML is wrapped with 'o' and 'a' elements respectively.


4. JSON has no standardized way of handling mixed content.
Theoretically the most simple mixed content could be handled with a
method similar to handling attributes but the prefix characters needed
to tell text and element apart depends on who made the function. If
mixed content consists of more than one text node and one element we
run into the reordering problem.

Don't use JSON if you need to work with mixed content. It is not what is
made for.

Bottom line - there is no standardization. If you want to do xml2json
and json2xml you pick your library and write for it.

best,
-Rob


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>