This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XQuery basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XQuery basic question" Watch "XQuery basic question" New topic
Author

XQuery basic question

biraji gafiff
Greenhorn

Joined: Jul 11, 2005
Posts: 27
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Nov 29, 2005
Posts: 2308
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.
;)
 
jQuery in Action, 2nd edition
 
subject: XQuery basic question
 
Similar Threads
How did you think of writing this book?
disassociate 2 domain objects
beanName attribute in jsp:usebean
Organized Reading
Castor Help with unmarshalling