Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Bug in XML::Parser

by graff (Chancellor)
on Oct 23, 2013 at 04:43 UTC ( #1059275=note: print w/replies, xml ) Need Help??

in reply to Bug in XML::Parser

Actually, depending on what you're actually trying to accomplish, something other than XML::Parser might be a better fit. In particular, XML::LibXML is vastly superior (IMHO). There's more documentation to look at, but in my experience, it's worth the effort, especially when you get to the XPath stuff.

Here's how I'd use XML::LibXML for that same simple example (to print out just the contents of "Amount" tags):

#!/usr/bin/perl use strict; use warnings; use XML::LibXML; my $parser = XML::LibXML->new; my $doc = $parser->parse_file( "org1.xml" ); my $xpath = XML::LibXML::XPathContext->new( $doc ); for my $node ( $xpath->findnodes( '//Amount' )) { print $node->textContent, "\n"; }
It doesn't get much simpler than that!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059275]
[LanX]: see soundfile https://en. wiki/human# Pronunciation
[Your Mother]: Just Another Perl 'Acker.
[LanX]: I pronounce it 'juːmən'
[Your Mother]: Hey, let's not bring antisemitism into the conversation.
[LanX]: for centuries posh English speakers tried to approach French, that's where all the trouble starts
[Eily]: Just another Perl coeurs
[Eily]: (perl with hearts, 'Acker with a French accent is pronunced like coeurs)
[LanX]: IMHO 'ju' for 'u' happens in English where they can't pronounce the French u (or German )
[LanX]: and I'm sure I read that *hotel* used to be pronounced 'otel by the English upperclass
[Your Mother]: American English vowels are pretty lazy/mumbly in general.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-03-27 17:13 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.