I have xml file (say input.xml) of the following schema:
<?xml version="1.0"?>
<TagA>
<TagB>
<File Folder="FOLDER1M\1" File="R1.txt" />
</TagB>
<TagB>
<File Folder="FOLDER1M\2" File="R2.txt" />
</TagB>
<TagB>
<File Folder="FOLDER2M\1" File="R3.txt" />
</TagB>
</TagA>
I need to parse this file and write the output to another file. The required output should be of the following form:
www.xyz.com\FOLDER1M\1\R1.txt
www.xyz.com\FOLDER1M\2\R2.txt
www.xyz.com\FOLDER2M\1\R3.txt
What I have got so far is:
echo 'cat /TagA/TagB/File/@*[name()="Folder" or name()="File"]' | xmllint --shell input.xml | grep '=' > xml_parsed
This gives me o/p of the form:
/ > cat /TagA/TagB/File/@*[name()="Folder" or name()="File"]
Folder="FOLDER1M\1"
File="R1.txt"
Folder="FOLDER1M\2"
File="R2.txt"
Folder="FOLDER2M\3"
File="R3.txt"
How should I go about getting my required output instead of this current o/p?