Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Using http://www.xpathtester.com/ to fixup the xml I get
<?xml version="1.0" encoding="UTF-8"?> <book xmlns:book="http://generated.ns/book"> <book:chapter id="bk444444ch1" type="CHAPTER"> <book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:hre +f="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444ch1?releas +eStatus=RELEASED" xlink:title="Photonic crystal light-emitting source +s" xlink:type="locator"></book:locator> <book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:hre +f="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444ch1?releas +eStatus=RELEASED&amp;format=pdf" xlink:title="Photonic crystal light- +emitting sources" xlink:type="locator"></book:locator> <book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:hre +f="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444ch1?releas +eStatus=RELEASED&amp;format=epub" xlink:title="Photonic crystal light +-emitting sources" xlink:type="locator"></book:locator> </book:chapter> </book>

And then setns/query using xmllint --shell

$ xmllint.exe --shell ravi06-03.xml / > / > whereis //@xlink:href XPath error : Undefined namespace prefix xmlXPathEval: evaluation failed //@xlink:href: no such node / > / > setns xlink=http://www.w3.org/1999/xlink / > / > whereis //@xlink:href /book/book:chapter/book:locator[1]/@xlink:href /book/book:chapter/book:locator[2]/@xlink:href /book/book:chapter/book:locator[3]/@xlink:href / > / > cat //@xlink:href ------- xlink:href="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444c +h1?releaseStatus=RELEASED" ------- xlink:href="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444c +h1?releaseStatus=RELEASED&amp;format=pdf" ------- xlink:href="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444c +h1?releaseStatus=RELEASED&amp;format=epub" / > / > / > cat (//@xlink:href/..)[1] ------- <book:locator xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/ +book/isbn/979-0-4444-1000-17/book-part/chapter/bk4 44444ch1?releaseStatus=RELEASED" xlink:title="Photonic crystal light-e +mitting sources" xlink:type="locator"/> / > / > / > bye $

In reply to Re^2: How to parse xml with namespase vale in XMl:LibXML? (xmllint --shell setns / xpathtester) by Anonymous Monk
in thread How to parse xml with namespase value in XMl:LibXML? by ravi06

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (10)
    As of 2014-09-02 19:17 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (29 votes), past polls