XML vs JSON for real

Since somebody, on Twitter, didn’t appreciated my examples in the JSON vs XML fight ( and I just want to remember everybody that I’m not for the former or the latter, without context ), here I post an example that should be a for-real case in favour of XML, applied in the context of evolving a system without breaking existing clients.

You know Twitter, uh?

Twitter lacks of I18N: you can’t selectively filter tweets without recurring to some hacks.

So, when you follow foreign users, you’ll face incomprehensible tweets, sooner or later: the guys of Twitter designed the service this way, so the API probably reflects this business logic.

The Atom representations of public timelines are pretty self-explanatory; so if you want to add the possibility to select a language for the tweet, the Atom would look like:

1
<content type="html">MissChristolyn: Do i really have to go back to work! #bullshit</content>

so, when twitter will add I18N support we’ll probably see something like this:

1
2
<content type="html" ns:lang='en_EN' >MissChristolyn: Do i really have to go back to work! #bullshit</content>
<content type="html" ns:lang='it_IT' >MissChristolyn: Devo proprio tornare al lavoro! #minghia</content>

Ciao!

comments powered by Disqus