1. Find existing modules
/
2. Enter XML query and select a module with a higher evaluation that can meet your needs:
XML::Simple
use warnings;
use XML::Simple;
use Data::Dumper;
#Convert XML files to Hash results
Copy the codeThe code is as follows:
my $xml=XMLin('abstract_sample.xml');
open(HASH,'>>XML_hash')||die"can not open the file: $!";
print HASH Dumper($xml);
#If you want to access the value of a certain XML node, you need to obtain the path defined according to XML
Copy the codeThe code is as follows:
print $xml->{PubmedArticle}->{MedlineCitation}->{PMID};
#The Hash structure converted to XML can be converted to XML output, but it should be noted that the converted XML may look different from the original XML file.
Copy the codeThe code is as follows:
$MeSH_XML=XMLout($xml->{PubmedArticle}->{MedlineCitation}->{MeshHeadingList});
print $MeSH_XML;
print $MeSH_XML;
For more use, see:
/~grantm/XML-Simple-2.18/lib/XML/
XML::Smart
my $xml=XML::Smart->new('abstract_sample.xml');
More usage references:
/~gmpassos/XML-Smart-1.6.9/lib/XML/