| [reply] [d/l] |
That article is six years old. And is written as if DOM and SAX were the only contenders. soliplaya, have a look at XML::Twig and XML::Rules. The first is often recommended here, the second is mine :-) and a nice combination of event and tree based parsing.
| [reply] |
Thanks Brothers.
Jenda, your XML::Rules module look interesting, and I'd like to give it a try.
What I need to do is fairly simple and boring : I need to parse a multi-level XML document, contained in the scaler $xmldoc, representing a Journal Article (*), into a simple hash like
my $href = {
'TI' => [ 'content of <PubArticle><Article><Title> tag' ],
'AU' => [ 'content of <PubArticle><Article><Authors><Author name="au
+thor1" tag',
'content of <PubArticle><Article><Authors><Author name="au
+thor2" tag',
etc.. ],
'REF' => [ and so on... ]
};
The end-result I want thus, is a hash in which each key corresponds to an arrayref, the array containing one or more string elements, these being picked up from tag attributes and/or values from the original XML document.
I admit I am a bit lost after the first read of the on-line doc. I guess what I don't see very clearly, from the first example at the head of the doc, is how I get the result in my $href hash.
(*) for a full example of the source XML, use this link :
http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&retmode=xml&id=18632282
| [reply] [d/l] |
XML::Rules is sax (maybe both), and XML::Twig is definetly both.
| [reply] |