aspose file tools*
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
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: 18564
    
    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: 18564
    
    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.
;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XQuery basic question