I am working with xquery updates in python and attempting to pull child elements out of the xml tree and insert them as new parent elements in the DBXML database. With the following xquery I was attempting to iterate each child and then insert the child back into the parent collection.
for $child in collection($items)/parent/path/to/child return (
insert node $child into collection($items)
)
However, the following error is produced.
XmlQueryEvaluationError Error: Cannot perform an update that creates a persistent document with more than one document element, line 0, column
I have also tried inserting xml with variable values but all nodes defined. Same error is produced.
for $child in collection($items)/parent/path/to/child return (
insert node <parent><item>{$child/item}</item></parent> into collection($items)
)