This content has been marked as final. Show 4 replies
My question is : in what purpose this condition is imposed ? and how can i insert new node under different nodes ?.To process a set of nodes in XQuery, the general approach is to use a sequence iterator (a for expression).
The same applies here with XQUF and the insert primitive.
For example :
will return :
copy $d := <root><item/><item/></root> modify ( for $i in $d/item return insert node <test/> into $i ) return $d
<root> <item> <test/> </item> <item> <test/> </item> </root>
Thank you very much,
I would be very grateful if you help me to know the goal of this condition+ because it is not imposed in other languages like XUpdate*.
This is because i have defined a basic update language based on indexation of XML data, in order to satisfy some properties and make them easy to implement,
and i am going to translate each XQuery update to my language, but i do not know if i should preserve this condition or not.
I would be very grateful if you help me to know the goal of this condition+ because it is not imposed in other languages like XUpdate*.Short answer : because that's what the specification says... :)
OK, well I guess that's because primarily XQUF is designed to work with XML databases.
If I use an analogy with relational databases and SQL language :
- a SQL INSERT statement only targets a single table, so does the XQUF insert primitive by targeting only a single node per expression
- a SQL DELETE statement can target multiple rows, the delete primitive too.
XQUF is an extension of XQuery, and as such it's meant to combine with the base language.
From a certain point of view, as I said earlier, it's not true to say that XQUF's insert primitive can't process multiple targets, because to do so we just have to use the base language : a FLWOR expression.
If XUpdate does not impose this restriction then I suppose, one way or another, the implementor has to iterate through the target nodes anyway, using the provided XPath expression.
Thank you very much for your help.