[Bioperl-l] Parsing XML entry :Please help
kumar s
ps_python@yahoo.com
Tue, 24 Sep 2002 09:20:41 -0700 (PDT)
Dear group,
I am trying to parse a XML file.
I tried the following script but I am unable to get
the result.
> ====================================
> My XML entry looks like this:
>
> <?xml version="1.0" encoding="utf-8">
> <GENE>
> <NAME>
> ACTIVIN A RECEPTOR, TYPE I
> <alt_name>
> ACVR1 ; ACTIVIN A RECEPTOR, TYPE II-LIKE KINASE 2;
> ACVRLK2 ; ACTIVIN RECEPTOR-LIKE KINASE 2; ALK2
> </alt_name>
> </NAME>
> <OMIM>
> 102576
> </OMIM>
> <GENE_MAP_LOCUS pub="9501322">
> 2q23-q24
> </GENE_MAP_LOCUS>
> <ENTRY source="Ref_Seq">
> <entry_cDNA>
> NM_001105
> </entry_cDNA>
> <entry_Prot>
> NP_001096
> </entry_Prot>
> </ENTRY>
> ............
> ======================
Following is the script.
> =======================
> My script:
> #!/usr/local/bin/perl
>
> my $sp_list_file = "samp.xml";
>
> open (SP, $sp_list_file) || die "cannot open
> \"$sp_list_file\": $!";
>
> while (my $line = <SP>) {
> if ($line =~ /(<NAME>)(.*\S)(<alt_name>)/) {
> print $line;
> }
> }
>
> ===============================
>
The problem is that I am not getting my Name and
alt_name fields.
Would any one please help how to deal with this
(parsing the parent child relationship).
Because NAME contains alt_name.
Please help me to parse my files.
thank you
SP
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com