http://www.perlmonks.org?node_id=218634

matth has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

The code shown in Re: Removing duplicate subtrees from XML works very well with the data shown in this posting. But with my data (as below)

<species name = "hs"> <sequence id = "1" title = "chromosome 1"> <genome_feature type = "CDS"> <gene id = "01"> <gene_seq number = "1"></gene_seq> </gene> </genome_feature> </sequence> </species> <species name = "hs"> <sequence id = "1" title = "chromosome 1"> <genome_feature type = "CDS"> <gene id = "17"> <gene_seq number = "2"></gene_seq> </gene> </genome_feature> </sequence> </species>
I get the following error messages:
bash-2.05$ perl perl_monks_F.pl sorted doc generation NOK: expected: <species name = "hs"> <sequence id = "1" title = "chromosome 1"> <genome_feature type = "CDS"> <gene id = "17"> <gene_seq number = "2"></gene_seq> </gene> </genome_feature> </sequence> </species> found: <species name="hs"> <sequence id="1" title="chromosome 1"> <genome_feature type="CDS"> <gene id="01"> <gene_seq number="1"></gene_seq> </gene> </genome_feature> </sequence> </species> Use of uninitialized value in substitution (s///) at perl_monks_F.pl l +ine 143, <DATA> chunk 2. Use of uninitialized value in substitution (s///) at perl_monks_F.pl l +ine 144, <DATA> chunk 2. Use of uninitialized value in substitution (s///) at perl_monks_F.pl l +ine 145, <DATA> chunk 2. Use of uninitialized value in string eq at perl_monks_F.pl line 50, <D +ATA> chunk 2. Use of uninitialized value in concatenation (.) or string at perl_monk +s_F.pl line 56, <DATA> chunk 2. merged doc generation NOK: expected: found: <species name="hs"> <sequence id="1" title="chromosome 1"> <genome_feature type="CDS"> <gene id="01"> <gene_seq number="1"></gene_seq> </gene> </genome_feature> </sequence> </species> bash-2.05$

Alterations that I made to the provided script were the addition of a few ErrorContext => 1 statements. And I have tested these slight alterations with the data used in the top posting link.

Replies are listed 'Best First'.
Re: XML::Twig
by matth (Monk) on Dec 09, 2002 at 23:14 UTC

    I was so focused on the problem that I forgot to ask if anyone could point out the structural difference between the XML data in the above posting and the XML data for mirod's code in Re: Removing duplicate subtrees from XML.

Re: XML::Twig
by matth (Monk) on Dec 10, 2002 at 01:04 UTC
    I am now doing some debugging work which is finding some obvious answers. I will come back with a report on how to alter the script in question. Hold on everyone.