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.
<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?