XQuery Update Facility is a small extention of XQuery for updating an XML document. Let us work on the following simple document:
<person born="23/06/1912" died="07/06/1954"> <name> <first>Alan</first> <last>Turing</last> </name> <profession>computer scientist</profession> <profession>mathematician</profession> <profession>cryptographer</profession> </person>
We perform the following update operations:
<person born="23/06/1912" died="07/06/1954"> <name> <first>Alan</first> <last>Turing</last> </name> </person>
<person born="23/06/1912" died="07/06/1954"> <name> <first>Alan</first> <last>Turing</last> </name> <profession/> </person>
<person born="23/06/1912" died="07/06/1954"> <name> <first>Alan</first> <last>Turing</last> </name> <profession>computer scientist</profession> </person>
<person born="23/06/1912" died="07/06/1954"> <name> <first>Alan</first> <last>Turing</last> </name> <profession start="1936" end="1954">computer scientist</profession> </person>
<person born="23/06/1912" died="07/06/1954"> <profession/> <name> <first>Alan</first> <last>Turing</last> </name> <profession start="1936" end="1954">computer scientist</profession> </person>Use as last (the default) to insert the node as last element into a node.
<person born="23/06/1912" died="07/06/1954"> <profession/> <profession/> <name> <first>Alan</first> <last>Turing</last> </name> <profession start="1936" end="1954">computer scientist</profession> </person>Use after to insert the node after another node.
<person died="07/06/1954"> <born>23/06/1912</born> <profession/> <profession/> <name> <first>Alan</first> <last>Turing</last> </name> <profession start="1936" end="1954">computer scientist</profession> </person>Now try this:
<person> <died>07/06/1954</died> <born>23/06/1912</born> <profession/> <profession/> <name> <first>Alan</first> <last>Turing</last> </name> <profession start="1936" end="1954">computer scientist</profession> </person>
<person> <died>07/06/1954</died> <born>23/06/1912</born> <profession/> <profession/> <name>Alan Turing</name> <profession start="1936" end="1954">computer scientist</profession> </person>
<person> <died>07/06/1954</died> <born>23/06/1912</born> <profession/> <profession/> <name>A. Turing</name> <profession start="1936" end="1954">computer scientist</profession> </person>
<person> <died>07/06/1954</died> <born>23/06/1912</born> <profession/> <profession/> <full-name>A. Turing</full-name> <profession start="1936" end="1954">computer scientist</profession> </person>