Revision [554]
This is an old revision of HowToParseXML made by DavidLee on 2009-05-22 20:11:18.
How to parse an xml file into a variable
By preloading xml data into variables you can use the data in memory in multiple operations without parsing it over and over.
XML variables are stored internally in a tree structure which is shared by most of the core commands so needs no additional processing.
xread
The xread command reads a file (or other input) into a variable.For example, to read the file "myfile.xml" into the variable "myfile"
xread myfile < myfile.xml
Since xread reads from standard input, it can also read from the the output of a pipeline.
For example, to parse the output of the xls command into the "mydir" variable.
xls | xread mydir