in reply to help on how to get information from XML file using XML::Twig requested

use strict; use XML::Rules; my $parser = XML::Rules->new( rules => { _default => 'content', 'residue' => sub { my ($tag,$attr,$context,$parents) = @_; if ($context->[-1] eq 'residues' and $context->[-2] eq 'fe +ature' and $parents->[-2]{feature_name} eq 'feature_one') { print "$attr->{residue_index} $attr->{residue_name}\n" } }, } ); $parser->parse(\*DATA); __DATA__ <sas_residue_annotation xmlns="http://url/Schema" xmlns:xsi="http://ww +w.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://url/Sche +ma test.xsd"> ...
or
use strict; use XML::Rules; my $parser = XML::Rules->new( rules => { _default => 'content', '^residues' => sub { my ($tag,$attr,$context,$parents) = @_; return ($context->[-1] eq 'feature' and $parents->[-1]{fea +ture_name} eq 'feature_one'); }, 'residue' => sub { my ($tag,$attr) = @_; print "$attr->{residue_index} $attr->{residue_name}\n" }, } ); $parser->parse(\*DATA); __DATA__ <sas_residue_annotation xmlns="http://url/Schema" xmlns:xsi="http://ww +w.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://url/Sche +ma test.xsd"> ...

The first version checks the parent and parent's parent tag name and the content of the <feature_name> tag whenever the <residue> tag is fully parsed, the second checks the <feature_name> whenever the opening tag <residues> is found and skips its contents if the <feature_name> is not the one you are looking for.

Jenda
Enoch was right!
Enjoy the last years of Rome.