XQuery has an updater, an official W3C recommendation called XQuery Update, to restructure the document.
You can use these updates:
Given that you created the database staff, with the message:
CREATE DB office /path/to/office.xml
Now you can use the XQuery Update tool and run the following query:
let $up := <Employee Name="Joe">
<Personal>
<SSN>666-66-1234</SSN>
</Personal>
<StaffInfo>
<Position>Doctor</Position>
<AccountableTo>Jeff</AccountableTo>
</StaffInfo>
</Employee>
return
insert node $up as last into doc('office')/Staff
This will be the node link referenced $upat the last position in your databasestaff
BaseX :
XQuery Update , xmlmind.com.
, API , , .
, , ; , BaseX.