News for hackers. Stuff that matters.
Re:Deprecating XML by dstein on Wednesday November 17, 2010 @10:49PM (#1916773)
It boils down to JSON being schemaless. In XML the data type is implicitly defined by the tag, whereas in JSON you need to arbitrarily encode the datatype as a property and somehow differentiate between properties and child elements/objects.
Re:Deprecating XML by murrayh on Wednesday November 17, 2010 @11:49PM (#1916924)
How about this?

    <Foo1 name="foo1">
        <Bar1 name="bar1"/>
    </Foo1>
    <Foo2 name="foo2">
        <Bar2 name="bar2"/>
    </Foo2>


    [["Foo1", {"name" : "foo1"}, [
        ["Bar1", {"name" : "bar1" }]
     ],
     ["Foo2", {"name" : "foo2"}, [
        ["Bar2", {"name" : "bar2" }]
     ]]
I personally wouldn't do this, but the arbitrary encodings between the two samples are now equivalent.
Re:Deprecating XML by dstein on Thursday November 18, 2010 @12:10AM (#1916964)
No, I think you proved my point.
Re:Deprecating XML by murrayh on Thursday November 18, 2010 @12:39AM (#1917020)
I still don't understand. What makes the XML version better than the JSON version? Why is creating XML like that a good solution, while creating JSON like that is not?
Re:Deprecating XML by dstein on Thursday November 18, 2010 @01:57AM (#1917134)
The XML is better because when the data types directly relate to tag names it is simple to understand, read, and write, process, and there are tons of XML libraries in every language that do object-xml serialization automatically. With JSON, since there are no types, you must manually write your own data-object serialization and embed the type system right into the data structure itself.
Re:Deprecating XML by j_baker on Thursday November 18, 2010 @05:03AM (#1917351)
It sounds like that might be better for a statically-typed language where you might need specific types in the data file. But I would argue that not only is it overkill in a dynamically-typed language, it's bad. We're talking about data here. There's no reason to couple it to data types in your code.

Plus, serialization to JSON in a dynamically-typed language is pretty much automagic compared to what you have to do with XML.