MonkPaul has asked for the wisdom of the Perl Monks concerning the following question:
Im trying still !!! to get an XML document parsed. I have used XML::Parser, and left it as default SAX as i dont want ot edit the document, only read it. My code is very simple, but i get some random results i was not expecting.
#!/usr/bin/perl -w use strict; use warnings; use XML::Parser; my $xml; my $results; $xml = new XML::Parser(Style => 'Debug'); $xml->parsefile('info.xml'); $xml->parse('<attribute Name="Column_Type" >F635 Median</attribute>');
this gives the following output:
\\ () entries || #10; entries || #9;#9; entries \\ (ID 10 Name Array_1_Measurement Column Metadata) entries enumeration || #10; entries enumeration || #9;#9;#9; entries enumeration \\ (Name Column_Type) entries enumeration attribute || F635 Median entries enumeration // entries enumeration || #10; entries enumeration || #9;#9;#9; entries enumeration \\ (Name Data_Type) entries enumeration attribute || INTEGER entries enumeration // entries enumeration || #10; entries enumeration || #9;#9;#9; entries enumeration \\ (Name Origin) entries enumeration attribute || Feature entries enumeration // entries enumeration || #10; entries enumeration || #9;#9;#9; entries enumeration \\ (Name Quantitation_Type) entries enumeration attribute || MeasuredSignal entries enumeration // entries enumeration || #10; entries enumeration || #9;#9;#9; entries enumeration \\ (Name Scale) entries enumeration attribute || LINEAR entries enumeration // entries enumeration || #10; entries enumeration || #9;#9;#9; entries enumeration \\ (Name LabelledExtract) entries enumeration attribute || - entries enumeration // entries //
I was just expecting to get back either F635 Median or all the info relating to that node.
The xml doc contains:
<?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>
Can any body tell me if this is whats supposed to happen or am i not defining the nodes in the perl script properly.
Any help would be great.
MonkPaul.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML Parsing
by thedoe (Monk) on Dec 14, 2005 at 18:43 UTC | |
|
Re: XML Parsing
by GrandFather (Saint) on Dec 14, 2005 at 21:40 UTC | |
by MonkPaul (Friar) on Dec 15, 2005 at 13:49 UTC |