http://www.perlmonks.org?node_id=924007


in reply to Re: LibXML, Namespaces, xpath expression - This should be simple.
in thread LibXML, Namespaces, xpath expression - This should be simple.

Creating a new xpc for every findnodes is not the way to go.

my $inner_xpc = XML::LibXML::XPathContext->new($nodeybits); $inner_xpc->registerNs( theNS => 'http://www.wow.com/BlahML'); $inner_xpc->findnodes(...)

can be written as

$xpc->findnodes(..., $nodeybits)

Replies are listed 'Best First'.
Re^3: LibXML, Namespaces, xpath expression - This should be simple.
by alittlebitdifferent (Initiate) on Oct 26, 2011 at 02:20 UTC
    Hi All, Thank-you so much for your help with this.

    I apologise for the time taken to reply but I had assumed the site would email me by default if I got a reply..and as I hadn't, assumed no one had responded. (Possible server issue my end)

    Setting up the namespace in the way shown worked perfectly. This site should show PayPal options for each submit. I'd happily send each Monk a dollar or two for the mental sanity you afforded me.

    Thank you so much.

    PS: Matt Seargent was right. LibXML is super quick when used properly.

    • My Data Pool using XPath - Parsing took 3 hours
    • My Data Pool using LibXML - Parsing takes 20 minutes. - Fantastic!

      PerlMonks doesn't send emails.

      Unless it's changed, PerlMonks has no expenses — hosting is donated by Pair — so receiving money would actually be a problem. On the other hand, the Perl Foundation does take donations, I believe. Some of that money is going towards fixing the more complicated bugs in Perl.