<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
But JSON and XML are not just two different syntaxes. They are
fundamentally different data models. It's not at all clear why
someone would want to use something as complex as the XML data model
to hold something as simple as JSON.<br>
<br>
Michael Kay<br>
Saxonica<br>
<br>
On 10/05/2012 19:22, Brad Cox wrote:
<blockquote
cite="mid:CAH2etF7+kw-_Eytzjs=R2CqYNfWyYbXUSK1J1BNTj5rG-e9G1A@mail.gmail.com"
type="cite">The best reason for doing it in JDOM I know of is for
the two external syntaxes to share EXACTLY the same DOM tree with
flawless conversion between them (subject to the JDOM as XML
subset notion). If that could be arranged with a separate tool
that would do too.
<div>
<br>
</div>
<div>FWIW: The JDOM parser I settled on is Jackson. There are a
bunch of others.<br>
<br>
<div class="gmail_quote">On Thu, May 10, 2012 at 1:02 PM,
Michael Kay <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:mike@saxonica.com" target="_blank">mike@saxonica.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">There's
been a lot of work on JSON-to-XML and XML-to-JSON
transformations. There is no single answer that works well
in all cases. There is a tension between being lossless and
producing something that is usable. An XML-to-JSON
transformation that can handle mixed content may produce
indigestible output for simple data-oriented XML.<br>
<br>
I don't think there is any good architectural reason to
regard XML-JSON transformation as being part of the same
component in the architecture as an XML tree model. Just
because it needs doing doesn't mean it needs doing in JDOM.
To me it's best kept separate.<span class="HOEnZb"><font
color="#888888"><br>
<br>
Michael Kay<br>
Saxonica</font></span>
<div class="HOEnZb">
<div class="h5"><br>
<br>
On 10/05/2012 16:43, Rolf Lear wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
So, searching the interweb, I see some discussion
about JSON parsers... I<br>
don't see a SAX specific one, but there appear to be a
number of StAX-like<br>
ones.... and we have StAX support directly now... ;-)<br>
<br>
Loading JSON in to JDOM is probably a lot simpler than
the opposite<br>
though....<br>
<br>
I don't see how anything but a simple XML document
could be output as a<br>
JSON 'output'.... the challenge would be how to deal
with the 'unusual'<br>
XML-like concepts, rather than the easy stuff?<br>
<br>
Like, if your XML has a namespace, then what?<br>
<br>
Rolf<br>
<br>
On Thu, 10 May 2012 08:38:03 -0700, Chris Pratt<<a
moz-do-not-send="true"
href="mailto:thechrispratt@gmail.com"
target="_blank">thechrispratt@gmail.com</a>><br>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Correct me if I'm wrong, but all that JDOM would
need for that to work<br>
would be a JSON SAX parser and a JSON Outputter.
Those could even be<br>
packaged in a companion jar file for those that want
the JDOM JSON<br>
</blockquote>
support.<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
(*Chris*)<br>
<br>
On Thu, May 10, 2012 at 4:12 AM, Brad Cox<<a
moz-do-not-send="true"
href="mailto:bcox@virtualschool.edu"
target="_blank">bcox@virtualschool.edu</a>><br>
</blockquote>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
This is based on experience using both, not a deep
analysis. More with<br>
XML<br>
than JSON to date. This work was in the context of
building XACML<br>
compilers<br>
that use the W3C DOM tree as their expression
tree. And inspired by<br>
recent<br>
W3C mailing list discussions on standardizing a
JSON syntax for XACML.<br>
<br>
They seem to be viewing JSON as I do, as a useful
subset of XML, with<br>
lack of namespaces and attributes the main
differences I can think of<br>
</blockquote>
</blockquote>
at<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
the moment. Lack of attributes not a problem for
XACML; it hardly uses<br>
them, just element values.<br>
<br>
The notion is to add a JSON parser in front that
builds the same XML<br>
(J)DOM tree you build now, plus a output path that
converts the tree to<br>
JSON on demand. The proposed extension is
appealing because it would<br>
allow<br>
the same XACML compiler to accept standard XACML
and/or standard JSON,<br>
and<br>
to trivially convert between the representations.<br>
<br>
On Wed, May 9, 2012 at 10:24 PM, Rolf Lear<<a
moz-do-not-send="true"
href="mailto:jdom@tuis.net" target="_blank">jdom@tuis.net</a>>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
I would *love* to hear how you expect JDOM
(XML-based) and JSON to<br>
</blockquote>
</blockquote>
</blockquote>
'hang<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
out' in the same place .... ;-)<br>
</blockquote>
--<br>
Cell: <a moz-do-not-send="true"
href="tel:703-594-1883" value="+17035941883"
target="_blank">703-594-1883</a><br>
Blog: <a moz-do-not-send="true"
href="http://bradjcox.blogspot.com"
target="_blank">http://bradjcox.blogspot.com</a><br>
Web: <a moz-do-not-send="true"
href="http://virtualschool.edu" target="_blank">http://virtualschool.edu</a><br>
Manassas VA 20111<br>
<br>
<br>
_______________________________________________<br>
To control your jdom-interest membership:<br>
<a moz-do-not-send="true"
href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com"
target="_blank">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a><br>
<br>
</blockquote>
</blockquote>
_______________________________________________<br>
To control your jdom-interest membership:<br>
<a moz-do-not-send="true"
href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com"
target="_blank">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a><br>
<br>
</blockquote>
_______________________________________________<br>
To control your jdom-interest membership:<br>
<a moz-do-not-send="true"
href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com"
target="_blank">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Cell: 703-594-1883<br>
Blog: <a moz-do-not-send="true"
href="http://bradjcox.blogspot.com">http://bradjcox.blogspot.com</a><br>
Web: <a moz-do-not-send="true" href="http://virtualschool.edu">http://virtualschool.edu</a><br>
Manassas VA 20111<br>
<br>
</div>
</blockquote>
</body>
</html>