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&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&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&format=pdf"
-------
xlink:href="/book/isbn/979-0-4444-1000-17/book-part/chapter/bk444444c
+h1?releaseStatus=RELEASED&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
$
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|