News for hackers. Stuff that matters.
Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by raverbashing on Saturday May 05, 2012 @11:51AM (#3932352)
Yes, it's a rant. Why? Because probably the author is tired of explaining the same things over and over to the XML defenders

Really

JSON is better (and XML is crap) it's ridiculous, it's obvious, it's clear cut, and when people "don't get it" you start resorting to irony

Like this:

> Enclose the /element/ in matching delimiters, not the tag

Let's compare them

<blah>foo</blah>

To json

blah: foo

1 - size (json wins)

2 - matching. Here's an exercise, try splitting json with sed, and then try with XML. Sed is a good exercise, because it's limited to simple grammars, so it kind of gives an idea how much trouble it is to parse each one

3 - redundancy: what would mean if the line was <blah>foo</lala> This is a mistake, right? But I can assume the tag name is blah and the data is foo. This is a glaring redundancy in grammar, bound to cause trouble.

Not to mention working with json data (like python) is natural compared to work with XML data.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by olavk on Saturday May 05, 2012 @12:08PM (#3932396)
Now try to apply this to the real world. The most popular and widely used SGML-derived format by far is (X)HTML. Show me e.g. how a paragraph with a few embedded links is improved by translating to JSON.

It is not. Of course some kinds of data are indeed expressed simpler with JSON.

Another real world example is RSS. More data-y that HTML but still may contain mixed content. Would it be better if it had been JSON from the beginning? The answer is not clear cut.

So maybe JSON is not always the right answer. Maybe it depends on what kind of data you want to express. But then it suddely is not a debate with a "XML-defenders" which "dont get it". Then it is a discussion about which tool is approprite in a given situation rather than a war between tribes. And how do you boost you ego and sense of superiority with a boring debate about tools?

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by raverbashing on Saturday May 05, 2012 @12:34PM (#3932477)
Popular != Better

"Show me e.g. how a paragraph with a few embedded links is improved by translating to JSON."

Even though HTML and XML are related, something like a web page is so ingrained that would be difficult to change

And JSON was never a markup language

The criticism of XML goes much more towards using it as a 'Key/Value' serialization format.

But you could imagine something like that (commas and colons would have to be replaced in a 'JSON' markup language)

{p: Read it on {href:news.ycombinator.com, a:Hacker News}}

Size gains, parsing speed gains.

RSS is not as clear cut, really, it's not a complicated structure, so it could be YAML for example

"So maybe JSON is not always the right answer. Maybe it depends on what kind of data you want to express"

XML has attributes, which I'm not against (unlike the article) and it has a more natural nesting of information. But for the majority of data, yes, JSON is better

This is about coder productivity (which is increased with JSON it's not even funny), either in Python/Java (even with the whole swiss army knife of XML libs they have)/C# or others.

Speed is also a issue. Encoding and decoding XML is slower, even with C speedups (example: Python lxml). And this is relevant for transformation of data or even sending it to the user.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by rjknight on Saturday May 05, 2012 @02:33PM (#3932825)
This was exactly the point addressed in the OP. Quote:

* SGML is a good idea when the markup overhead is less than 2%. Even attributes is a good idea when the textual element contents is the "real meat" of the document and attributes only aid processing*

In your example where you want to add a small amount of markup to a large amount of text, SGML wins. JSON is a worse choice for such cases.

It seems to me that we have collectively solved these problems, which is why we have both JSON and XML. Naggum was right when he said that XML was being applied incorrectly, and Douglas Crockford solved the problem by introducing JSON.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by antidoh on Saturday May 05, 2012 @12:59PM (#3932559)
"Yes, it's a rant. Why? Because probably the author is tired of explaining the same things over and over to the XML defenders"

If one is tired of talking, one's best option is to shut up.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by mindcrime on Saturday May 05, 2012 @04:00PM (#3933100)
"Yes, it's a rant. Why? Because probably the author is tired of explaining the same things over and over to the XML defenders"

If one is tired of talking, one's best option is to shut up.

Even better, if one's arguments are not being found persuasive, perhaps one should come up with better arguments, or reconsider their position...

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by DavidAbrams on Saturday May 05, 2012 @03:43PM (#3933047)
He didn't say he was tired of talking. He said he was tired of REPEATING.

If one is too tired to read, one should be too tired to comment on the reading material.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by eta_carinae on Saturday May 05, 2012 @12:48PM (#3932522)
> JSON is better (and XML is crap) it's ridiculous

Except that in JSON, strings need to be surrounded by double quotes. Why impose on human readers a syntactic requirement that only compilers/interpreters need?

From this respect, JSON is in the same mixed bag as XML is.

If you want to go down that slope, be consistent and push YAML instead of JSON.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by raverbashing on Saturday May 05, 2012 @01:03PM (#3932572)
"Except that in JSON, strings need to be surrounded by double quotes"

This is a funny limitation, since JSON came from Javascript and {a:1} is perfectly legal in Javascript

"Why impose on human readers a syntactic requirement that only compilers/interpreters need?"

Well, for human readers this can be bad, but <> can be bothersome as well.

YAML could be a better choice (or something similar to JSON but with better syntax)

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by mkmcdonald on Saturday May 05, 2012 @01:42PM (#3932670)
> This is a funny limitation, since JSON came from Javascript and {a:1} is perfectly legal in Javascript.

That's only legal when the key is not a reserved word. I never use that form, as it's error-prone.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by jahewson on Saturday May 05, 2012 @12:25PM (#3932448)
JSON has its fair share of shortcomings too, for example:

XML

    <p>Some <b>bold<b> text</p>
JSON

    { "p": ["Some ", { "b": "bold" }, " text"] }
Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by gouranga on Saturday May 05, 2012 @01:54PM (#3932705)
I wouldn't ever mark up documents like that. JSON and XML are shitty languages for such things. So is html to be honest but we're stuck with it.

Markdown, rst or something are better. As long as it has a simple deterministic terse grammar that is... If you want you can stuff that inside XML or rst and attach metadata.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by jahewson on Saturday May 05, 2012 @02:21PM (#3932780)
That was the point. Markdown too has its weakness: it doesn't scale very well - how do I markup chemical symbols, or gene names, or complex tables? We soon run out of keyboard symbols to denote many concepts...
Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by gouranga on Saturday May 05, 2012 @02:37PM (#3932840)
i agree. I think We should create and use extensible languages (both written and spoken) that are better represented and understood both machine and human.

Mathematics, English and most notations are too full of nuances to represent things unambiguously.

Re:Erik Naggum's XML Rant from 2002: Disturbingly prescient by Estragon on Saturday May 05, 2012 @12:22PM (#3932436)

  > Yes, it's a rant. Why?
Actually, the rant's author just liked/felt compelled to communicate that way, pretty much all the time. It really hurt him socially.