updateXML and NULL Values
UpdateXML() treats NULL values by mapping them to non-existent attribute, element, or text values. For instance if you update node, '//empno/text()' with a NULL value, it is treated as if element empno is being removed. Setting an attribute to NULL removes the attribute. There are exceptions to this. The section, "NULL Updates When Object Types Are Generated by XML Schema Registration" on page 4-36 discusses this further.
In this case, when you update an element and pass a NULL value to it, the attributes and children of the element disappear, and the element becomes empty. A NULL value for an element update is equivalent to setting the element to empty.
Note: Setting '//empno' to NULL has the same effect as setting ' //empno/text()' to NULL.
NULL Updates When Object Types Are Generated by XML Schema Registration
NULL updates remove the element except when DOM fidelity is not maintained.
Example 4-37 NULL Updates with updateXML()
Consider the XML document:
<shipAddr gate="xxx"> <street>333</street> <city>333</city> </shipAddr> </PO>
The clause:
updateXML(xmlcol,,/PO/shipAddr,,null)
is equivalent to making it:
<pono>21</pono> <shipAddr/> </PO>
If you update the text node to NULL, then this is equivalent to removing the text value alone. For example:
UPDATEXML(xmlcol,,/PO/shipAddr/street/text(),/ null) results in:
<pono>21</pono> <shipAddr> <street/> <city>333</city> </shipAddr> </PO>
Post a comment