I have the following XML document loaded in MarkLogic database:
<x:books xmlns:x="urn:books">
<book id="bk001">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<price>44.95</price>
<pub_date>2000-10-01</pub_date>
<review>An amazing story of nothing.</review>
</book>
<book id="bk002">
<author>Poet</author>
<title>The Poet's First Poem</title>
<genre>Poem</genre>
<price>24.95</price>
<review>Least poetic poems.</review>
</book>
</x:books>
I am new to XQuery. How would I retrieve the values from the XML document as I retrieve it from a SQL database?
Output:
BookID | Author | Title | Genre | price | pub_date | review
bk001 | Writer | The First Book | Fiction | 44.95 | 2000-10-01
bk002 | Poet | The Poet's First Poem | Poem | 24.95 | Least poetic poems.
Note: Not necessary a pipe delimited but some collection list.
Can some one share some link or help me write this XQuery? I am new to this.