xidel was kind to me, reducing much of my boiling invective for XML configuration files to a rolling simmer aimed at the inconvenience. xmlstarlet has the potential to cool that simmer to a lukewarm distaste.
Now neither tool alone will ever quench my hatred, and together I doubt very much they’d be able to do more than keep my day from turning black. But K.Mandla is definitely mellowing out.
xmlstarlet is a collection of tools for formatting, polling, editing and transforming XML files. That alone is only a sliver of what it can do, and in the right hands it would no doubt be quite a weapon.
For us mere mortals, it’s nice to be able to reformat files and get their components nested cleanly, or to see the breakdown between elements, or just validate them to make sure they’re not broken. (That’s the worst, a broken XML configuration file. I writhe just to think about it.)
But xmlstarlet can apparently also count the number of elements matching an expression, trickle through an XML document and total up specific elements and output to a table, and if you’re lucky, even make a list of links embedded in an XHTML file. Take a look at the documentation if you don’t believe me.
Little people like me, who never have an occasion to work with XML other than my .config/openbox/rc.xml file, will find the most basic xmlstarlet tricks to be sufficient reason to keep it around. “It can clean up my menu.xml file? Please, please, please!”
On the other hand, that’s just a tiny taste of what xmlstarlet can do, and a brief spin past the documentation will make that abundantly clear. Make sure you take a close look at this one before you move to the next tool du jour. You’ll be missing out otherwise. 😉