can some one please help me on getting xml data into shell scripting
here is my requirement.
I need to print CHILD value along with attribute value of CHILD and parent if the CHILD value is greater than 100
here is my data
<mydata>
<parent detail="school1">
<CHILD attribute="0">0</CHILD>
<CHILD attribute="1">1932</CHILD>
<CHILD attribute="2">0</CHILD>
<CHILD attribute="3">500</CHILD>
<CHILD attribute="4">0</CHILD>
<CHILD attribute="5">0</CHILD>
<CHILD attribute="6">7819</CHILD>
<CHILD attribute="7">0</CHILD>
<CHILD attribute="8">299</CHILD>
<CHILD attribute="9">0</CHILD>
</parent>
<parent detail="school2">
<CHILD attribute="0">1</CHILD>
<CHILD attribute="1">7000</CHILD>
<CHILD attribute="2">0</CHILD>
<CHILD attribute="3">0</CHILD>
<CHILD attribute="4">600</CHILD>
<CHILD attribute="5">0</CHILD>
<CHILD attribute="6">11674</CHILD>
<CHILD attribute="7">0</CHILD>
<CHILD attribute="8">489</CHILD>
<CHILD attribute="9">0</CHILD>
</parent>
</mydata>
my external file values are like this childvalue_limits.txt file
attribute0=100
attribute1=60
attribute3=80
attribute4=90
attribute5=100
attribute6=90
attribute7=50
attribute8=80
attribute9=70
I need to pass this file as argument to script and to take these values dynamically into the condition..
current code
sed 's|><|>\n<|g' $WORKING_PATH/xml_detail.log | awk -F'"|<|>' '/parent detail/{p=$3} /CHILD attribute/{att=$3;val=$5;if(val>100)print "child value on " p, "attribute "att,"is at value: "val ,"\n"}'
current output
child value on school2 attribute 1 is at value 1000
child value on school2 attribute 4 is at value 600
.....
.....
required output should be like this
child value on school2 attribute 1 is at value 1000 and threshold is 60
child value on school2 attribute 4 is at value 600 and threshold is 90
.....
.....
please note: threshold value is the dynamic value passed to if condition through a separate file called childvalue_limits.txt