Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to review a lot of xml files and find the values of tag <mainterm type=??? > when the the '<descriptors> value is "CTC".
See one record in my xml file:
<item>
<bibrecord>
<item-info>
<copyright type="Els">Copyright 2007 AAA, All rights reserved.</copyright>
</item-info>
<head>
<citation-info>
<citation-type code="ar"/>
</citation-info>
<descriptorgroup>
<descriptors controlled="y" type="CCV">
<descriptor>
<mainterm weight="a">Corrosion protection</mainterm>
</descriptor>
</descriptors>
<descriptors controlled="y" type="CMH"> <br<descriptor>
<mainterm weight="a">Corrosion inhibitors</mainterm>
</descriptor>
</descriptors>
<descriptors controlled="y" type="CTC">
<descriptor>
<mainterm weight="a">G</mainterm>
</descriptor>
</descriptors>
</descriptorgroup>
</enhancement>
</head>
</bibrecord>
</item>
The output should be:
'<mainterm weight="a">G</mainterm>'
That means only when '<descriptors type="CTC"' then print the '<mainterm>' value.
Can you help me?
Back to
Seekers of Perl Wisdom