Hi,
It looks like you are not passing anything into your call to xdmp:spawn.
You need to pass in the external variable $x along with its value (that
you are getting from your FLOWR). Note that it is not the same as the
$x from your load.xqy module, as those two modules run in different
contexts.
Something like:
xdmp:spawn("loadFile.xqy", (xs:QName("x"), $x))
-Danny
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Vijayasekar Palaniswamy
Sent: Monday, September 15, 2008 7:33 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Fileuploading using spawn
Hello,
This is the code, I am using to upload files. It gives output message as
"Files Uploaded" but i didn't see any files uploaded into ML db.
Any correction in the code?
(: load.xqy :)
let $contentdir := "C:\sam2"
return (
for $x in xdmp:filesystem-directory($contentdir)//dir:pathname/text()
[ends-with(lower-case(.), ".xml")]
return (
try {
xdmp:spawn("loadFile.xqy"), "Files Uploaded"
}
catch ($err) {
$err
}
)
)
(: loadFile.xqy :)
define variable $x as xs:string external
define variable $contentDir as xs:string {"C:\sam2"}
xdmp:document-load($x,
<options xmlns="xdmp:document-load">
<uri>{fn:concat("/sam/mcd/",
fn:substring-after($x, fn:concat($contentDir,
"\")))}</uri>
<repair>full</repair>
<forests>
<forest>{xdmp:forest("test")}</forest>
</forests>
<encoding>ISO-8859-1</encoding>
</options>)
--
Regards,
Vijayasekar. P,
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general