Update multiple XML files using XQuery
Posted: Thu Apr 16, 2015 10:34 pm
Hello,
I've got problems to update several documents using a XQuery Update.
The oxygen version is 16. I use Saxon-EE XQuery 9.5.1.5. as a transformer and disabled XQuery 3.0 support.
Here is an example:
I receive the following error message:
Updated document discarded because it was not read using doc(). Warning
If I try
I receive the following message: java.io.FileNotFoundException
It works if I modify the script and update only one file
It would be great if you could give some advice how to modify the xquery script
to update multiple files?
Thanks,
Franziska
I've got problems to update several documents using a XQuery Update.
The oxygen version is 16. I use Saxon-EE XQuery 9.5.1.5. as a transformer and disabled XQuery 3.0 support.
Here is an example:
Code: Select all
xquery version "1.0";
let $docs := collection("file:///C:/My_Collection/?select=*.xml")
for $doc in $docs
return
replace value of node $doc/rootElement/element with 'new value'
Updated document discarded because it was not read using doc(). Warning
If I try
Code: Select all
replace value of node doc($doc)/rootElement/element with 'new value'
It works if I modify the script and update only one file
Code: Select all
let $doc := doc("file:///C:/My_Collection/File.xml")
return
replace value of node $doc/rootElement/element with 'new value'
to update multiple files?
Thanks,
Franziska