• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XQuery basic question

 
biraji gafiff
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, i have two xml tags named "book" with "author_id" attribute and "author" with "id" attribute (among others), suppose that i want the name of the author who wrote a specific book, how could i do that?

Thanks in advance.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the XPath expression would be something like this:That would work if you were using XML tools that supported XPath.

Edit: I just noticed you had the word "XQuery" hidden in the title of your post. I don't know XQuery but maybe it supports XPath, or maybe you can adapt that expression to work in it.
[ May 27, 2007: Message edited by: Paul Clapham ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
That would work if you were using XML tools that supported XPath.


Hi Paul, How are you using tags like name and title.Nothing is mentioned about those in the initial post.

For the XML below:



use the following XPath.



Tested using XPath Explorer eclipse plugin.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rahul Bhattacharjee:
Hi Paul, How are you using tags like name and title.Nothing is mentioned about those in the initial post.
That's true. The initial post didn't mention anything about where the name and title were coming from, so I made a guess. That is often easier than asking the poster to provide useful details. If the guess is wrong, the poster can then respond with those details.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
That's true. The initial post didn't mention anything about where the name and title were coming from, so I made a guess. That is often easier than asking the poster to provide useful details. If the guess is wrong, the poster can then respond with those details.


Thats very true.I was think that I am missing something.
;)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic