Export (0) Print
Expand All

XML Data Modification Language (XML DML)

The XML Data Modification Language (XML DML) is an extension of the XQuery language. As defined by W3C, the XQuery language lacks the Data Manipulation (DML) part. The XML DML introduced in this topic, and also the XQuery language, provides a fully functional query and data-modification language that you can use against the xml data type.

The XML DML adds the following case-sensitive keywords to XQuery:

  • insert
  • delete
  • replace value of

As described in xml Data Type, you can create variables and columns of the xml type and assign XML documents or fragments to them. To modify or update these XML instances, do the following:

Note that there are some attributes that cannot be inserted, deleted, or have their value modified. For example:

  • For typed or untyped xml, the attributes are xmlns, xmlns:*, and xml:base.
  • For typed xml only, the attributes are xsi:nil, and xsi:type.

Other restrictions include the following:

  • For typed or untyped xml, inserting the attribute xml:base will fail.
  • For typed xml, deleting and modifying the xsi:nil attribute will fail. For untyped xml, you can delete the attribute or modify its value.
  • For typed xml, modifying the value of the xs:type attribute will fail. For untyped xml, you can modify the attribute value.

When you modify a typed XML instance, the final format must be a valid instance of that type. Otherwise, a validation error is returned.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft