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!


Hi there! I recently wrote an ebook on web application security, currently sold on leanpub, the Amazon Kindle store and gumroad.

It contains 160+ pages of content dedicated to securing web applications and improving your security awareness when building web apps, with chapters ranging from explaining how to secure HTTP cookies with the right flags to understanding why it is important to consider joining a bug bounty program.

Feel free to skim through some of the free chapters published on this blog and, if the content seems interesting enough to you, grab a copy on leanpub, the Amazon Kindle store, gumroad or simply checkout right down below!

Buy the Web Application Security ebook for $6.99

In the mood for some more reading?

...or check the archives.