Error:can't open file?


{
LET $books := document("data/books.xml")//book
FOR $book IN $books
LET $chapters := document($book/@href)//chapter
RETURN

{$book/title}

{
FOR $chapter IN $chapters
RETURN
{$chapter/title}

}


}


I'm getting following error

books.xml and oopXML.xml are both in same directory i.e data

Are these functions
id(IDREF), idref(string) implemented in QUIP?
Your help is greatly appreciated!
Thanks

You don’t actually say what the value of @href is. As far as I know, QuiP is always resolving a relative URI relative to the location of the file containing the query. According to the latest specs (borrowed from XSLT) the URI in this case should be resolved relative to the base URI of the node containing the @href attribute - which in effect means relative to the source document containing the reference - but the document() spec was less explicit at the time QuiP was coded.

As far as I can tell, the id() and idref() functions are not implemented. This is because QuiP has no concept of type annotation for nodes; if there are no nodes annotated as IDs, then these functions are meaningless.

Michael Kay

Michael,
I’am posting my XML file and query again as follows:


Object-Oriented XML
Kurt Cagle
Rene Dubois


Programming SVG
Kurt Cagle


Early Adopter XQuery
Dan Maharry
Kurt Cagle
Rogerio Saran
Mark Fussel
Nalleli Lopez



and depending upon this file I want to run this query


{
LET $books := document(“data/books.xml”)//book
FOR $book IN $books
LET $chapters := document($book/@href)//chapter
RETURN

{$book/title}

{
FOR $chapter IN $chapters
RETURN
{$chapter/title}

}


}


Now I guess it should take href value (XML file) and try to collect chapter nodes of them.
Is it not possible to get all href value (xml files) from this query?
I’m getting following error

books.xml and oopXML.xml are both in same directory i.e data

As I suggested in my previous response, QuiP is not implementing the rule that where the first argument to document() is a node, the relative URI is resolved relative to the base URI of that node. Also, QuiP doesn’t provide the second argument to the document() function, and it doesn’t provide the resolve-uri function defined in later XQuery working drafts. So I’m afraid there is no easy workaround to this: the only thing I could suggest would be to preprocess the data files using XSLT to make all URIs absolute.

I’m afraid this is the downside of using a prototype implementation of a working draft specification.

Michael Kay