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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: XML data reading/output
by ikegami (Patriarch) on Sep 04, 2009 at 19:11 UTC | |
by ramrod (Curate) on Sep 04, 2009 at 19:35 UTC | |
by ikegami (Patriarch) on Sep 04, 2009 at 20:27 UTC | |
Re: XML data reading/output
by toolic (Bishop) on Sep 04, 2009 at 19:16 UTC | |
by Anonymous Monk on Sep 04, 2009 at 22:36 UTC | |
Re: XML data reading/output
by ramrod (Curate) on Sep 04, 2009 at 19:14 UTC | |
Re: XML data reading/output
by arun_kom (Monk) on Sep 04, 2009 at 19:12 UTC |
Back to
Seekers of Perl Wisdom