<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: David Pollak was right about XML and JSON</title>
	<atom:link href="http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/</link>
	<description></description>
	<lastBuildDate>Tue, 03 Jan 2012 15:08:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-180734</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 15 Oct 2008 08:07:44 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-180734</guid>
		<description>@Arnaud: 

&quot;Otherwise, you are losing some information in the translation and there is no more structural equivalence between the XML and JSON.&quot;

Yes.

There are two problems though: is the child of items an array or an object? If it depends on the number of children, this is very error prone for the client.

People don&#039;t want to write large code in JS to access data. For example compare:

&lt;pre&gt;
mycart = ...
mycart.cart.items.item[0].name
&lt;/pre&gt;

vs.

&lt;pre&gt;
mycart = ....
mycart.items[0].name
&lt;/pre&gt;

Many people consider the second one more readable.</description>
		<content:encoded><![CDATA[<p>@Arnaud: </p>
<p>&#8220;Otherwise, you are losing some information in the translation and there is no more structural equivalence between the XML and JSON.&#8221;</p>
<p>Yes.</p>
<p>There are two problems though: is the child of items an array or an object? If it depends on the number of children, this is very error prone for the client.</p>
<p>People don&#8217;t want to write large code in JS to access data. For example compare:</p>
<pre>
mycart = ...
mycart.cart.items.item[0].name
</pre>
<p>vs.</p>
<pre>
mycart = ....
mycart.items[0].name
</pre>
<p>Many people consider the second one more readable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arnaud Bailly</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-180725</link>
		<dc:creator>Arnaud Bailly</dc:creator>
		<pubDate>Wed, 15 Oct 2008 07:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-180725</guid>
		<description>Hello,
I am sure completely dumb and missing something very important, but I really don&#039;t understand the problem. To me, I  would have converted 

     
       
       one  
       
    

to at least

{ cart: { &quot;items&quot;: { item: { &quot;name&quot;: &quot;one&quot; } } } }  

Otherwise, you are losing some information in the translation and there is no more structural equivalence between the XML and JSON.

As other people pointed out, converting a one element nested tag to a singleton list is a matter of 1) conventions or 2) typing. I think in common XML based tools I use like Ant or Maven, it is a common assumption that the pattern  ... denotes a collection. 

Regards.

PS; thanks for your excellent articles !</description>
		<content:encoded><![CDATA[<p>Hello,<br />
I am sure completely dumb and missing something very important, but I really don&#8217;t understand the problem. To me, I  would have converted </p>
<p>       one  </p>
<p>to at least</p>
<p>{ cart: { &#8220;items&#8221;: { item: { &#8220;name&#8221;: &#8220;one&#8221; } } } }  </p>
<p>Otherwise, you are losing some information in the translation and there is no more structural equivalence between the XML and JSON.</p>
<p>As other people pointed out, converting a one element nested tag to a singleton list is a matter of 1) conventions or 2) typing. I think in common XML based tools I use like Ant or Maven, it is a common assumption that the pattern  &#8230; denotes a collection. </p>
<p>Regards.</p>
<p>PS; thanks for your excellent articles !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MrZ</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-180331</link>
		<dc:creator>MrZ</dc:creator>
		<pubDate>Tue, 14 Oct 2008 18:03:01 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-180331</guid>
		<description>Hi EveryOne! :-D
This Post it&#039;s very interesting and switch on a very important problem for who, like me, want some kind of light web-services-protocol... And it&#039;s a very difficult discussion, so what follow are only ideas, may be wrong so...


i think that we must separate problem:

1] XML is extensible because one document don&#039;t have a real semantic, i want to say that a text like this means nothing:

     
       
       one  
       two  
        
    

   when i say &#039;this tag means that&#039; every things it&#039;s ok and this is the task of DTD
   and XSD


2] Namespaces born to avoid conflict and give a way to express some kind of semantic relations...


3] XML has a DOM and this is important: it&#039;s the description of &#039;HOW&#039; and not &#039;WHAT&#039;
   Also for this XML it&#039;s useful... Parsing...Parsing...

4] since other points, we can try with a simulation of DOM not of XML it&#039;s self!
   But one point of attention: this is a way to make a traslation... So it&#039;s right
   to say:&quot;there&#039;s no simple way to traslate XML to JSON&quot;... Preserve the value
   of X of XML it&#039;s the real problem... 

         {
          name:&#039;cart&#039;,
          type:ROOT,
          attributes:[],
          value:&#039;&#039;
          childs:[
                  {
                   name:&#039;items&#039;,
	   type:NODE,
                   attributes:[],
                   value:&#039;&#039;
                   childs:[
                            {
                             name:&#039;item&#039;,
	                     type:NODE,
          		     attributes:[],
          		     value:&#039;&#039;
          		     childs:{
                             	                name:&#039;name&#039;,
	  		type:NODE,
          		     	attributes:[],
          		     	value:&#039;one&#039;
          		     	childs:{}
                                                }
                           } ,
                               {
                                 name:&#039;item&#039;,
	                 type:NODE,
          		 attributes:[],
          		 value:&#039;&#039;
          		 childs:{
                             	                name:&#039;name&#039;,
	  		type:NODE,
          		     	attributes:[],
          		     	value:&#039;one&#039;
          		     	childs:{}
                               }
                            }
                          ]
                  } 
                 ]
          }

Now i can generate also schema or apply schema...
About me the summary is that XML is a textual specification with XSD as meta-specification and if i have some software that use it, complexity can&#039;t be eliminated and must percolate to JSON...
All The Best

MrZ</description>
		<content:encoded><![CDATA[<p>Hi EveryOne! :-D<br />
This Post it&#8217;s very interesting and switch on a very important problem for who, like me, want some kind of light web-services-protocol&#8230; And it&#8217;s a very difficult discussion, so what follow are only ideas, may be wrong so&#8230;</p>
<p>i think that we must separate problem:</p>
<p>1] XML is extensible because one document don&#8217;t have a real semantic, i want to say that a text like this means nothing:</p>
<p>       one<br />
       two  </p>
<p>   when i say &#8216;this tag means that&#8217; every things it&#8217;s ok and this is the task of DTD<br />
   and XSD</p>
<p>2] Namespaces born to avoid conflict and give a way to express some kind of semantic relations&#8230;</p>
<p>3] XML has a DOM and this is important: it&#8217;s the description of &#8216;HOW&#8217; and not &#8216;WHAT&#8217;<br />
   Also for this XML it&#8217;s useful&#8230; Parsing&#8230;Parsing&#8230;</p>
<p>4] since other points, we can try with a simulation of DOM not of XML it&#8217;s self!<br />
   But one point of attention: this is a way to make a traslation&#8230; So it&#8217;s right<br />
   to say:&#8221;there&#8217;s no simple way to traslate XML to JSON&#8221;&#8230; Preserve the value<br />
   of X of XML it&#8217;s the real problem&#8230; </p>
<p>         {<br />
          name:&#8217;cart&#8217;,<br />
          type:ROOT,<br />
          attributes:[],<br />
          value:&#8221;<br />
          childs:[<br />
                  {<br />
                   name:'items',<br />
	   type:NODE,<br />
                   attributes:[],<br />
                   value:&#8221;<br />
                   childs:[<br />
                            {<br />
                             name:'item',<br />
	                     type:NODE,<br />
          		     attributes:[],<br />
          		     value:&#8221;<br />
          		     childs:{<br />
                             	                name:&#8217;name&#8217;,<br />
	  		type:NODE,<br />
          		     	attributes:[],<br />
          		     	value:&#8217;one&#8217;<br />
          		     	childs:{}<br />
                                                }<br />
                           } ,<br />
                               {<br />
                                 name:&#8217;item&#8217;,<br />
	                 type:NODE,<br />
          		 attributes:[],<br />
          		 value:&#8221;<br />
          		 childs:{<br />
                             	                name:&#8217;name&#8217;,<br />
	  		type:NODE,<br />
          		     	attributes:[],<br />
          		     	value:&#8217;one&#8217;<br />
          		     	childs:{}<br />
                               }<br />
                            }<br />
                          ]<br />
                  }<br />
                 ]<br />
          }</p>
<p>Now i can generate also schema or apply schema&#8230;<br />
About me the summary is that XML is a textual specification with XSD as meta-specification and if i have some software that use it, complexity can&#8217;t be eliminated and must percolate to JSON&#8230;<br />
All The Best</p>
<p>MrZ</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-180034</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Tue, 14 Oct 2008 07:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-180034</guid>
		<description>@John: Nice post, informative, thanks</description>
		<content:encoded><![CDATA[<p>@John: Nice post, informative, thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Cowan</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-179972</link>
		<dc:creator>John Cowan</dc:creator>
		<pubDate>Tue, 14 Oct 2008 05:01:17 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-179972</guid>
		<description>See my posting &lt;a href=&quot;http://recycledknowledge.blogspot.com/2008/10/restricted-xml-to-good-quality-json.html&quot; rel=&quot;nofollow&quot;&gt;Converting Restricted XML to Good-Quality JSON&lt;/a&gt; for something useful that can be done, given some assumptions and some schema information.</description>
		<content:encoded><![CDATA[<p>See my posting <a href="http://recycledknowledge.blogspot.com/2008/10/restricted-xml-to-good-quality-json.html" rel="nofollow">Converting Restricted XML to Good-Quality JSON</a> for something useful that can be done, given some assumptions and some schema information.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-179692</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 13 Oct 2008 20:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-179692</guid>
		<description>@Andre: Yes thought about that, looks very fragile though.

@David: Yes, a schema is the same as &quot;type&quot; or a namespace like list:items - some meta information about the structure.

But when transforming XML to JSON within the browser using a schema

a.) the schema is slow, needs another request and isn&#039;t very easy to implement
b.) is not generic, item needs to be defined. When not being generic but specific it would be easier to write a list_xml2json.xsl file</description>
		<content:encoded><![CDATA[<p>@Andre: Yes thought about that, looks very fragile though.</p>
<p>@David: Yes, a schema is the same as &#8220;type&#8221; or a namespace like list:items &#8211; some meta information about the structure.</p>
<p>But when transforming XML to JSON within the browser using a schema</p>
<p>a.) the schema is slow, needs another request and isn&#8217;t very easy to implement<br />
b.) is not generic, item needs to be defined. When not being generic but specific it would be easier to write a list_xml2json.xsl file</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David M. Karr</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-179682</link>
		<dc:creator>David M. Karr</dc:creator>
		<pubDate>Mon, 13 Oct 2008 20:30:29 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-179682</guid>
		<description>Perhaps I&#039;m missing something in this discussion, but I think the point this problem illustrates is that you can&#039;t do a clean conversion without the XML schema. The schema will define the &quot;maxOccurs&quot; attribute of the &quot;item&quot; element in the &quot;items&quot; element. If it&#039;s greater than one or unbounded, then it can make it an array. If not, then it won&#039;t.</description>
		<content:encoded><![CDATA[<p>Perhaps I&#8217;m missing something in this discussion, but I think the point this problem illustrates is that you can&#8217;t do a clean conversion without the XML schema. The schema will define the &#8220;maxOccurs&#8221; attribute of the &#8220;item&#8221; element in the &#8220;items&#8221; element. If it&#8217;s greater than one or unbounded, then it can make it an array. If not, then it won&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: André</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-179659</link>
		<dc:creator>André</dc:creator>
		<pubDate>Mon, 13 Oct 2008 20:11:40 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-179659</guid>
		<description>Maybe you can solve this problem by using some conventions, e.g. if the root of parent node is pretty much the same as the child node this has to be a list.
I thing those conventions are necessary to describe and support the understanding of data structures. Otherwise there is no need for XML schema ;-)</description>
		<content:encoded><![CDATA[<p>Maybe you can solve this problem by using some conventions, e.g. if the root of parent node is pretty much the same as the child node this has to be a list.<br />
I thing those conventions are necessary to describe and support the understanding of data structures. Otherwise there is no need for XML schema ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-179558</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 13 Oct 2008 16:57:30 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-179558</guid>
		<description>No it won&#039;t go the other way, see for example

http://stephan.reposita.org/archives/2008/04/04/rest-lean-json-and-xml-from-the-same-code/

{ items: [ 1, 2, 3] } cannot be converted to XML, because the type of &quot;1&quot; etc is missing.

One would need { items: { item: [1,2,3] } } to generate XML. Which is in itself no nice JSON.</description>
		<content:encoded><![CDATA[<p>No it won&#8217;t go the other way, see for example</p>
<p><a href="http://stephan.reposita.org/archives/2008/04/04/rest-lean-json-and-xml-from-the-same-code/" rel="nofollow">http://stephan.reposita.org/archives/2008/04/04/rest-lean-json-and-xml-from-the-same-code/</a></p>
<p>{ items: [ 1, 2, 3] } cannot be converted to XML, because the type of &#8220;1&#8243; etc is missing.</p>
<p>One would need { items: { item: [1,2,3] } } to generate XML. Which is in itself no nice JSON.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Casper</title>
		<link>http://codemonkeyism.com/david-pollak-was-right-about-xml-and-json/comment-page-1/#comment-179507</link>
		<dc:creator>Casper</dc:creator>
		<pubDate>Mon, 13 Oct 2008 15:03:49 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/10/13/david-pollak-was-right-about-xml-and-json/#comment-179507</guid>
		<description>Interesting mismatch. You could go the other way though, right? Since JSON does have the notion of an array/list, you would always be able to convert a JSON representation into an XML representation.</description>
		<content:encoded><![CDATA[<p>Interesting mismatch. You could go the other way though, right? Since JSON does have the notion of an array/list, you would always be able to convert a JSON representation into an XML representation.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (user agent is rejected)
Database Caching 4/20 queries in 0.022 seconds using disk

Served from: codemonkeyism.com @ 2012-02-10 07:42:39 -->
