Xquery problem

Hi
I got a problem in writing an xquery. I gave a simple example to address it.
Assume there is a dtd like this:

and the conforming xml document is the following:

George Good night 2006 Ocean Thirteen 2007 Brad Ocean Thirteen 2007 Mr Smith 2007

Is it possible to write a xquery that gets all the movie information of the actor whose name is “george”?
I was frustrated about this for a long time, and really need help!

I don’t understand your document, actually…the tags are not associated with any tags. If the tag was inside the element, then you could find the s with selected s inside them (so the tag would be repeated for each movie George was in):
George

Or, technically, you can put the tags inside the element:
George etc

For the context given, I would suggest the first structure.

Thank you for your reply.
I didn’t type the whole dtd correctly.
here it is:





and with this DTD, “name” and “movie” do have an association.
My question is, given such a DTD and its xml document, that can I write an xquery to get what I want? thank you again!

Thank you for your reply.
I didn’t type the whole dtd correctly.
here it is:





and with this DTD, “name” and “movie” do have an association.
My question is, given such a DTD and its xml document, that can I write an xquery to get what I want? thank you again!

Failed again.
I have to change the present format of DTD:

actor-> (name, movie*)*
name->pcdata
movie->(title,year)
title->pcdata
year->pcdata

Your document doesn

I used this query on the following documents:

In this example I would usually expect the data to be documents of the form:

Something is getting lost in this posting. I don’t understand what appears to be an empty DTD:

Jason - perhaps you could post your DTD as an attachment to help us understand what you are trying to achieve?

Thank you for your concern.
I have edited my DTD one the first post.

Normally, you would assume that a name and the corresponding movies are grouped under a common XML tag, as the previous replies suggest, or that you have a separate document for each actor. Then you could query:


for $doc in collection("ino:etc") 
where $doc/root/name="George"
return $doc/root/movie

Now, with the modelling you currently have, a query such as


for $doc in collection("ino:etc") 
let $name:=$doc/root/name[.="George"]
let $name1:=$doc/root/name[. >> $name][1]
return $doc/root/movie[. >> $name and . << $name1]

does the job. But I really recommend changing the DTD

Best regards

Harald

regards

Harald