I already mentioned how to get human readable xml from the non-human readable.
Today I had a human readable xml file, but it had many branches, some deep, with lots of information in it. I wanted to know only the names of the nodes which are direct children of the root node.
e.g.
<someRootElement><firstChildOfRoot><someOtherBS><couldBeMoreBS>… </…> …</…></firstchildOfRoot><secondChildOfRoot>…insert tons of crap here</secondChildOfRoot><nextchild…
I could have done this by paging the file, but this would not have scaled. It was just long enough that I didn’t want to do this.
xmllint rescued me again. I started in shell mode
$ xmllint –shell mystupid/xmlfile/thatIhate.xmlhated
Then I am greeted with an xmllint prompt with which I can navigate my xml document much like I do a filesystem with command like ls and cd.
/ > ls
— 21 someRootElement
/ > cd someRootElement
someRootElement > ls
ta – 3
— 21 firstchildOfRoot
ta – 3
— 21 secondChildOfRoot
Pretty cool eh?
<3 Tools.
Could you put the link to download xmllint?
Thanks.
http://lordcold.blogspot.com
Lord Cold, xmllint is part of the libxml2.