Can anyone please suggest how can I retrieve accnum in experiment.Here is one way to do it, after cleaning up what I think is the XML you want:
use strict; use warnings; use XML::Twig; my $xfile = <<EOF; <experiment accnum="E-GEOD-8918" array="Agilent Human Genome CGH Micro +array 44B [G4410B]" biosamples-png="download/mageml/E-GEOD-8918.biosa +mples.png" biosamples-svg="download/mageml/E-GEOD-8918.biosamples.svg +" fgem="download/mageml/E-GEOD-8918.processed.zip" fgem-count="87" hy +bs="87" id="1636341195" name="CGH profiling of 87 indolent non-hodgki +n s lymphoma (NHL)" releasedate="2008-06-19" samples="174" sdrf="do +wnload/mageml/E-GEOD-8918.sdrf.txt" species="Homo sapiens" two-column +s="download/mageml/E-GEOD-8918.2columns.txt"> <users> <user id="1"/> </users> <secondaryaccessions> <secondaryaccession>GSE8918</secondaryaccession> </secondaryaccessions> </experiment> EOF my $t= new XML::Twig(); $t->parse($xfile); my $experiment = $t->root(); print 'accnum = ', $experiment->att('accnum'), "\n";
prints:
accnum = E-GEOD-8918
In reply to Re: XML parsing
by toolic
in thread XML parsing
by advait
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |