how do I access xml attribute details using XML::Simple and/or XML::Mini::Document or XML::LibXML ?
I am trying to understand and compare 4 ways in which I could use perl cpan xml modules to extract some info from a bunch of given XML files.
I have written some proof of concept code using XML::XPath and am left wondering how this "simple" task would be solved by using on of the other XML modules? I am a beginner in some ways and learn best by observing a problem and then copying that sample and modyfying it to my needs.
my perl XML::XPath code #!/usr/bin/perl #file: show-barcodes-with-XML-XPath.pl #!/usr/bin/perl use XML::XPath; my $file = "00000002.TIF.xml"; my $xp = XML::XPath->new(filename => $file); my $barcode_code39 = $xp->find('/barcodes/source/index/symbol[@type="C +ODE-39"]/data'); my $barcode_qrcode = $xp->find('/barcodes/source/index/symbol[@type="Q +R-Code"]/data'); $barcode_code39 = substr($barcode_code39, 0, 10); print ("Code 39: ", $barcode_code39, "\n"); print ("QR-Code: ", $barcode_qrcode, "\n"); #print ("processed: " . $file . "\n"); #file: 00000002.TIF.xml <barcodes xmlns='http://zbar.sourceforge.net/2008/barcode'> <source href='00000002.TIF'> <index num='0'> <symbol type='QR-Code' quality='1'><data><![CDATA[0037000249]]></data> +</symbol> <symbol type='CODE-39' quality='102'><data><![CDATA[0037000249P]]></da +ta></symbol> </index> </source> </barcodes>
How would I employ XML::Simple to do the "same" thing ?
And how would I write the same thing using XML::Mini::Document ?
And lastly how would I write the same thing using XML::LibXML ?
Thanks for any insights into how this would be done using one of the above
In reply to care to illustrate use of xml cpan modules? by BigBear
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |