Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
What is wrong with registerNs()?
my $dom = $parser->parse_file("book.xml"); my $root = $dom->documentElement(); my $xpc = XML::LibXML::XPathContext->new($root); $xpc->registerNs(xlink => "http://www.w3.org/1999/xlink") or die "Coul +dn't register Namespace - $!";
The xml file is :
<?xml version="1.0" encoding="UTF-8"?> <book:bookResource xmlns:xlink="http://www.w3.org/1999/xlink"> <book:book> <book:chapter id="bk111111ch1" type="CHAPTER"> <book:locator xlink:href="/book/isbn/979-0-1234-1111-1/book-part/chapt +er/bk111111ch1?releaseStatus=UNRELEASED" xlink:title="Photonic crysta +l light-emitting sources" xlink:type="locator" xmlns:xlink="http://ww +w.w3.org/1999/xlink"/> <book:locator xlink:href="/book/isbn/979-0-1234-1111-1/book-part/chapt +er/bk111111ch1?releaseStatus=UNRELEASED&amp;format=pdf" xlink:title=" +Photonic crystal light-emitting sources" xlink:type="locator" xmlns:x +link="http://www.w3.org/1999/xlink"/> <book:locator xlink:href="/book/isbn/979-0-1234-1111-1/book-part/chapt +er/bk111111ch1?releaseStatus=UNRELEASED&amp;format=epub" xlink:title= +"Photonic crystal light-emitting sources" xlink:type="locator" xmlns: +xlink="http://www.w3.org/1999/xlink"/> <book:meta doi="10.1088/bk111111ch1" firstPage="1-1" lastPage="1-118"> <book:author givenName="Roger" surname="Ebert"><book:affiliation xlink +:href="bk111111ch1af1" xlink:type="locator" xmlns:xlink="http://www.w +3.org/1999/xlink"/></book:author> <book:affiliation name="Cavendish Laboratory, University of Cambridge" +><book:locator xlink:href="bk111111ch1af1" xlink:type="locator" xmlns +:xlink="http://www.w3.org/1999/xlink"/></book:affiliation> </book:meta> </book:chapter> </book:book> </book:bookResource>

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-16 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found