Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Not able to register namespace in XML::LibXML on Linux. (or die)

by Anonymous Monk
on Jul 15, 2013 at 10:04 UTC ( [id://1044342]=note: print w/replies, xml ) Need Help??


in reply to Not able to register namespace in XML::LibXML on Linux.

Why did you add or die? How is registerNs documented to signal failure? Does registerNs use $!?
  • Comment on Re: Not able to register namespace in XML::LibXML on Linux. (or die)
  • Download Code

Replies are listed 'Best First'.
Re^2: Not able to register namespace in XML::LibXML on Linux. (or die)
by Anonymous Monk on Jul 15, 2013 at 10:14 UTC
    Why registerNs when you don't have to?
    #!/usr/bin/perl -- use strict; use warnings; use XML::LibXML; use Data::Dump qw/ dd pp /; Main( @ARGV ); exit( 0 ); sub Main { my $dom = XML::LibXML->new( qw/ recover 2 / )->load_xml( location => shift || q{ravi06-05.xml}, ); print $_->nodePath,"\n" for $dom->findnodes(q{//@xlink:href}); print $_->nodePath,"\n" for $dom->findnodes(q{//book:locator/@xlin +k:href}); } __END__ /book:bookResource/book:book/book:chapter/book:locator[1]/@xlink:href /book:bookResource/book:book/book:chapter/book:locator[2]/@xlink:href /book:bookResource/book:book/book:chapter/book:locator[3]/@xlink:href /book:bookResource/book:book/book:chapter/book:meta/book:author/book:a +ffiliation/@xlink:href /book:bookResource/book:book/book:chapter/book:meta/book:affiliation/b +ook:locator/@xlink:href /book:bookResource/book:book/book:chapter/book:locator[1]/@xlink:href /book:bookResource/book:book/book:chapter/book:locator[2]/@xlink:href /book:bookResource/book:book/book:chapter/book:locator[3]/@xlink:href /book:bookResource/book:book/book:chapter/book:meta/book:affiliation/b +ook:locator/@xlink:href
      Hi, we don't have Data::Dump. We can't use predicates("book:locator1") either.

        Hi, we don't have Data::Dump

        And then what happened?

        We can't use predicates("book:locator1") either.

        And I just showed that you can. I have

        $ perl -MData::Dump -MXML::LibXML -e " dd[ XML::LibXML->VERSION, XML:: +LibXML::LIBXML_DOTTED_VERSION ]" [2.0014, "2.9.0"]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1044342]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found