The Fastest Readable Xml

I hate xml.

I really hate it. No humans should have to read it.

As a developer, if I have to even think about Xml, then it is because some developer before me made the wrong choice.*

That said, sometimes a developer full of contempt toward Xml does need to read xml.

Both feedburner and WordPress output mostly well spaces xml, but what if I look at rss from blogs.msdn.com? It looks like the webserver is running a whitespace filter. This is not human readable Xml. Now, I COULD copy and paste into Visual Studio, but then I have to open a new xml document, or save what I’m viewing in the browser and open in Visual Studio. All too many steps.

Cygwin comes with an optional program called xmllint. It is part of the libxml2 package, so be sure to select libxml2 when you run cygwin setup.exe.

$ curl http://blogs.msdn.com/giorgio/rss.xml | xmllint –format – | less

This reformats the xml into a nice 2-space indented by tag display.

* This may be a bit extreme, but I will stand by it most of the time.

4 thoughts on “The Fastest Readable Xml”

  1. I also hate XML as a reader. But I find it necessary in lots of cases, and xmllint looks handy when that happens. Thanks!

    Off topic: Are you planning to use your door prize for the Kalamazoo UML Applied class on June 16? There’s plenty of room left, but I need to start planning meals and handouts and stuff.

  2. My guess is that the guys that wrote the MSDN blog engine agree with you that humans shouldn’t be reading XML – applications should. Therefore, they are far less concerned about the formatting of the XML than other blog engines who obviously expect people to read their XML so go through the trouble of pretty printing it. Sweet – you and Microsoft agree on something… 😉

    For the record, I love XML. But I don’t think that humans should be reading it. The better it’s working, the further behind the tools it should disappear.

  3. yes, totally. I didn’t mean to pick on blogs.msdn.com. It was just the first example I ran across.

Comments are closed.