View Full Version : Constructing queries in XQuery on the basis a DTD

11-16-2008, 07:54 PM
Ok i have been recently studying xpath but im a bit stumped on xquery.When writing queries do you write them in the same way as xpath or is it different?

I have been trying to answer these sample questions but have had no luck.
The question is:

The following DTD defines bibliographic information.

<!ELEMENT bib (book* )>
<!ELEMENT book (title, (author+ | editor+ ), publisher, price )>
<!ELEMENT author (last, first )>
<!ELEMENT editor (last, first, affiliation )>
<!ELEMENT title (#PCDATA )>
<!ELEMENT last (#PCDATA )>
<!ELEMENT first (#PCDATA )>
<!ELEMENT affiliation (#PCDATA )>
<!ELEMENT publisher (#PCDATA )>
<!ELEMENT price (#PCDATA )>

Construct the following queries in XQuery on the basis of the above DTD:

Find all authors who have authored a book and an article in the same year.?

This was what i was given on the question and im stumped.
Can any one give me the answers/tips/hits on how to answer these.I think i just need the answer to one of them just to see what i should be doing.

Thanks in advance