
On Tue, Sep 11, 2007 at 06:59:09AM -0700, Philip Webster wrote:
Stefan Manegold wrote:
an then query this XML file using XQuery to load all document in a single collection:
for $doc in fn:doc("[abolute_path_to]docs.xml")/docs/doc return pf:add-doc($doc/@loc, $doc/@name, "MyCollection")
That should be it.
Hi Stefan,
I've created the doc.xml file, which now has the unique filename of every xml file in it. However, I tried to use the XQuery sample you provided and got an error from MonetDB. I'm using the MAPI client in XQuery mode to enter the code from the post quoted above. The query spans over 2 lines and is terminated using Ctrl-D (It's a Red Hat Linux server).
Here is the error:
QUERY = for $doc in fn:doc("/mnt/da/monetdb/docs.xml")/docs/doc ERROR = !type error: no variant of function pf:add-doc accepts the given argument type(s): string?; string?; string !type error: maybe you meant: !type error: pf:add-doc (string, string) as docmgmt !type error: pf:add-doc (string, string, string) as docmgmt !type error: pf:add-doc (string, string, integer) as docmgmt !type error: pf:add-doc (string, string, string, integer) as docmgmt !type error: illegal arguments for function pf:add-doc
sorry, a static typing issue; try for $doc in fn:doc("/mnt/da/monetdb/docs.xml")/docs/doc return pf:add-doc(exactly-one($doc/@loc), exactly-one($doc/@name), "MyCollection") instead. Stefan
I'm not intimately familiar with XQuery - is there some sort of type conversion that needs to be performed on the values extracted from the XML file?
Regards,
Phil
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |