1. Find existing Modules
http://search.cpan.org/
2. Input XML query, select the higher evaluation, and can meet their own needs of modules:
Xml::simple
Use warnings;
Use Xml::simple;
Use Data::D umper;
#将XML文件转化为Hash结果
Copy Code code as follows:
My $xml =xmlin (' abstract_sample.xml ');
Open (HASH, ' >>xml_hash ') | | Die "Can not open the file: $!";
Print HASH dumper ($xml);
#想访问XML某个节点的值, you need to obtain an XML-defined path based on the
Copy Code code as follows:
Print $xml->{pubmedarticle}->{medlinecitation}->{pmid};
#可以将XML转化为的Hash结构重新转换为XML输出, but be aware that the transformed XML may be different from the original XML file appearance
Copy Code code as follows:
$MeSH _xml=xmlout ($xml->{pubmedarticle}->{medlinecitation}->{meshheadinglist});
Print $MeSH _xml;
For more use, refer to:
http://search.cpan.org/~grantm/XML-Simple-2.18/lib/XML/Simple.pm
Xml::smart
My $xml =xml::smart->new (' abstract_sample.xml ');
More usage References:
http://search.cpan.org/~gmpassos/XML-Smart-1.6.9/lib/XML/Smart.pm