Ludeon Forums

RimWorld => General Discussion => Topic started by: axefrog on May 13, 2015, 10:26:43 PM

Title: Why XML instead of JSON?
Post by: axefrog on May 13, 2015, 10:26:43 PM
Hey Tynan, why'd you go with XML over JSON? XML is so... verbose... and... 10 years ago! ;)

<SerializationFormats>
    <XML><Bloated /></XML>
    <JSON><Clean /></XML>
</SerializationFormats>

{
    XML: 'Bloated',
    JSON: 'Clean'
}
Title: Re: Why XML instead of JSON?
Post by: Tynan on May 13, 2015, 11:13:54 PM
The real reason is that XML was already supported by the .NET framework and Visual Studio.

And it's not much 'dirtier' IMO. It's less concise, but the <> tags are clean compared with spewing quotations, colons, commas, and curly braces everywhere.

It wouldn't be impossible to write a content loader that could take either. I just haven't had any reason to. XML works just fine and with a decent editor it's not hard to edit at all.

You can see this in the examples, when they're actually written properly with equivalent data:


<SerializationFormats>
    <XML>Long but clean</XML>
    <JSON>Concise but dirty</JSON>
</SerializationFormats>

"SerializationFormats":{
    "XML": "Long but clean",
    "JSON": "Concise but dirty"
}
Title: Re: Why XML instead of JSON?
Post by: converging on May 13, 2015, 11:43:08 PM
[SerializationFormats]
XML=Long but clean
JSON=Concise but dirty
IniFile=Timeless
Title: Re: Why XML instead of JSON?
Post by: Latta on May 13, 2015, 11:45:29 PM
And JSON would make modding harder for those who are not friendly with programming, at least JSON itself.
It's easy to not add quote, colon, (especially) comma by a mistake if one's not used to. XML is so, verbose, that it is easier.
Well I'm not a fan of all those closing tags and such, but modern editors support auto-closing and multi editing("select next occurence"), even free ones like Atom.
Title: Re: Why XML instead of JSON?
Post by: axefrog on May 14, 2015, 12:02:44 AM
Fair enough. Was just curious is all. I'll arm wrestle you over your assertion that XML is cleaner though.
Title: Re: Why XML instead of JSON?
Post by: Tynan on May 14, 2015, 12:18:52 AM
Well, I'm super used to it now.
Title: Re: Why XML instead of JSON?
Post by: Shinzy on May 14, 2015, 12:33:10 PM
Quote from: converging on May 13, 2015, 11:43:08 PM
IniFile=Timeless

Ooohh ini files!
Those things made me feel genious when I finally realized I could by editing those change textures of a specific level without overriding the base textures for all the other levels in one freeware top down shooting game ;D *tear*
Title: Re: Why XML instead of JSON?
Post by: Mystic on May 14, 2015, 07:37:28 PM
I've got to side with Tynan on this. I work with both XML and JSON in my job, and I still prefer XML for a number of reasons (some of which, like XSLT and Xpath, don't really apply here). IMO, JSON's main advantages surface when transferring data over the Internets and to/from browsers, which also isn't happening here.
Title: Re: Why XML instead of JSON?
Post by: StorymasterQ on May 14, 2015, 09:53:16 PM
I know, Registry Entries!

F*** the non-Windows users!
Bloat the Registry and F*** the Windows users too!
Title: Re: Why XML instead of JSON?
Post by: rexx1888 on May 15, 2015, 01:12:58 AM
let the mud slinging commence lol

As a designer, i couldnt give a toss as long as it works. My programmer on the other hand has lots to say on the subject, an it mainly boils down to "xml is gross" lol.
Title: Re: Why XML instead of JSON?
Post by: b0rsuk on May 17, 2015, 05:18:52 AM
XML is like violence. If it doesn't work, you need to use more.
Title: Re: Why XML instead of JSON?
Post by: Rahjital on May 17, 2015, 07:21:20 AM
Quote from: b0rsuk on May 17, 2015, 05:18:52 AM
XML is like violence.

In that the wise avoid it? :D
Title: Re: Why XML instead of JSON?
Post by: ZestyLemons on May 18, 2015, 04:58:34 AM
Quote from: Rahjital on May 17, 2015, 07:21:20 AM
Quote from: b0rsuk on May 17, 2015, 05:18:52 AM
XML is like violence.

In that the wise avoid it? :D

You can't avoid it forever.
(just like XML)
Title: Re: Why XML instead of JSON?
Post by: psilous on May 18, 2015, 06:14:29 PM
such a really interesting question and answer. Thanks!
Title: Re: Why XML instead of JSON?
Post by: iuiz on May 27, 2015, 05:09:36 PM
Quote from: axefrog on May 13, 2015, 10:26:43 PM
Hey Tynan, why'd you go with XML over JSON? XML is so... verbose... and... 10 years ago! ;)

<SerializationFormats>
    <XML><Bloated /></XML>
    <JSON><Clean /></XML>
</SerializationFormats>

{
    XML: 'Bloated',
    JSON: 'Clean'
}

Your comparison is kinda polemic and shows to me, that you want to try to compare apples and oranges. XML is a wide technology stack that offers a huge range of features like defining own datatypes, keywords or transformations (look into XSLT for example). It is also easier to define your own domain specific language with XML, which is something that you want in so many cases, when the complexity of your format expands and you work with lots of developers (for example 20 or more).

You can also add comments to your files and it is easily readable by humans. I mean humans can read JSON too, but in big documents, where you implement against a big DTD or something, XML is in my opinion most of the times the better format.

That you stated that it is 10 years old should never be an reason to not use it. At the time when XML came up there were several other formats, that were kinda used everywhere. Take EDIFACT as an example. However XML works so well, that it became king of the human readable formats in no time.

However JSON is also a great format and can be used nearly as often as XML. In my opinion If you want a format for data interchange within your own system landscape AND you write it from hand from time to time or need a not expensive to develop format JSON works great. JSON is the little lightweight brother of XML. It is great, but simply does not offer the same feature set.


Title: Re: Why XML instead of JSON?
Post by: Devon_v on May 27, 2015, 05:47:11 PM
Curly braces give me a warm, fuzzy feeling and are the reason I cannot deal with Python as a language. :)
Title: Re: Why XML instead of JSON?
Post by: colblackwolf on May 28, 2015, 02:01:22 AM
Quote from: b0rsuk on May 17, 2015, 05:18:52 AM
XML is like violence.

It may not be the best solution to a specific problem, but it is always a solution   ;)
Title: Re: Why XML instead of JSON?
Post by: Adamiks on May 28, 2015, 01:08:59 PM
Quote from: colblackwolf on May 28, 2015, 02:01:22 AM
Quote from: b0rsuk on May 17, 2015, 05:18:52 AM
XML is like violence.

It may not be the best solution to a specific problem, but it is always a solution   ;)

To much violence against XML's can end with errors in your ass, like in real life violence can end with a spear in your ass.

Ahh.... Rimworld.....
Title: Re: Why XML instead of JSON?
Post by: Mystic on May 30, 2015, 10:47:52 PM
Quote from: Devon_v on May 27, 2015, 05:47:11 PM
Curly braces give me a warm, fuzzy feeling and are the reason I cannot deal with Python as a language. :)

I agree with this in the area of languages at least (if not necessarily in data exchange formats). Python's indenting approach is IMO really not good for developing any programs of substantial size. Too easy for things to go wrong, even for someone as militant about proper indentation (in any/all languages) as myself.

On the other hand, even though I developed exclusively in C/C++ for nearly two decades, I am really, really over the need for semicolons as statement terminators. I consider them needless, cluttered syntax at this point.

Thus you have two of the reasons why Swift is well on its way to becoming my preferred language.
Title: Re: Why XML instead of JSON?
Post by: MrWiggles on May 31, 2015, 02:24:41 AM
This question just boils down to, "Why aren't your preferences my preferences?"
Title: Re: Why XML instead of JSON?
Post by: Vas on May 31, 2015, 05:34:45 PM
This is something I made a while back when I was going to make a web version of EDB's Prepare Carefully mod.

I put it on pastebin instead of here; http://pastebin.com/J5u3ASvm