You should read the documentation for XML::Parse which tells you that that is what you will get.
To solve your actual problem try using XML::TreeBuilder. Here's some code to get you started:
use strict; use warnings; use XML::TreeBuilder; my $xml; my $results; $xml = XML::TreeBuilder->new; $xml->parse(do{local $/; <DATA>}); my @elements = $xml->look_down('Name', 'Column_Type'); for (@elements) { next if $_->as_text () ne 'F635 Median'; print $_->parent ()->as_text(); } __DATA__ <?xml version="1.0" encoding="UTF-8"?> <entries> <enumeration ID="10" Name="Array_1_Measurement Column Metadata +" > <attribute Name="Column_Type" >F635 Median</attribute> <attribute Name="Data_Type" >INTEGER</attribute> <attribute Name="Origin" >Feature</attribute> <attribute Name="Quantitation_Type" >MeasuredSignal</attri +bute> <attribute Name="Scale" >LINEAR</attribute> <attribute Name="LabelledExtract" >-</attribute></enumerat +ion> <enumeration ID="1" Name="Array_1_Measurement Data" > <attribute Name="Gene" >AAC1</attribute> <attribute Name="F635 Median" >325</attribute> <attribute Name="B635 Median" >103</attribute></enumeratio +n> <enumeration ID="2" Name="Array_1_Measurement Data" > <attribute Name="Gene" >AAC3</attribute> <attribute Name="F635 Median" >389</attribute> <attribute Name="B635 Median" >115</attribute></enumeratio +n> </entries>
Prints:
F635 Median INTEGER Feature MeasuredSignal LINEAR -
In reply to Re: XML Parsing
by GrandFather
in thread XML Parsing
by MonkPaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |