http://qs321.pair.com?node_id=793563


in reply to XML data reading/output

In other words, you want to dump the elements that match XPath
//descriptors[@type="CTC"]/descriptor/mainterm

Using XML::LibXML, the syntax is something like

for my $mainterm ( $doc->findnodes( '//descriptors[@type="CTC"]/descriptor/mainterm' +) ) { print $mainterm->toString(); }

XML::Twig would also be awesome here.

Update: Changed
//descriptors[type="CTC"]/mainterm
to
//descriptors[@type="CTC"]/descriptor/mainterm
as per reply.