Appending and deleting items in the XML document

The Order class provides methods for adding and removing items from the Order document.

You can append a new item to the Order document with the appendItem( ) method, whose parameters specify ItemId, ItemName, Quantity, and units for the new item:

update order_docs
 set order_doc = order_doc>>appendItem("864",
 	"Bracket", "3","12")

appendItem( ) is a void method that modifies the instance. When you invoke such a method in an update statement, you reference it as shown, as if it were an order-valued method that returns the updated item.

Delete an existing item from the order document using deleteItem( ). deleteItem( ) specifies the number of the item to be deleted. The numbering begins with zero, so the following command deletes the second item from the specified row.

update order_docs
 	set order_doc = order_doc>>deleteItem(1)
 where id = “1”