Updating xml file using xquery

By commenting, you are accepting the IBM commenting guidelines and the DISQUS terms of service.

We are looking forward to its wide adoption as the language of choice for updating XML databases.

This article aims to provide a very quick and basic introduction to the XQUF.

As of March 14, 2008, the XQuery Update Facility specification has become a "Candidate Recommendation", which means it is now pretty stable. The answer seems obvious, yet after all the XQuery language itself - or its cousin XSLT2 - is powerful enough to write any transformation of an XML tree.

Therefore a simple "store" or "put" function, applied to the result of such transformation, could seem sufficient to achieve any kind of database update operation. In practice this would be neither very natural, convenient, nor very efficient (such an approach requires storing back the whole document and makes optimizing very difficult).

Prerequisites: the reader is presumed to have some acquaintance with XML Query and its (or contents) of the same node.

The XQUF specifications take care of forbidding such ambiguous updates.

You can specify the if expression in Expression2 of the replace value of XML DML statement, as shown in the following example.

Expression1 identifies that the Labor Hours attribute from the first work center is to be updated.

'; BEGIN res := DBMS_XDB_REPOS.create Resource('/public/emps.xml', empsxmlstring); res := DBMS_XDB_REPOS.create Resource('/public/empsns.xml', empsxmlnsstring); res := DBMS_XDB_REPOS.create Resource('/public/depts.xml', deptsxmlstring); END; / -manipulation language. OBJECT_VALUE AS "p" RETURNING CONTENT) AS VARCHAR2(30)); REFERENCE COUNT(*) -------------------------------- ---------- TFOX-20021009123337784PDT 3 XQuery API for Java (XQJ), also known as JSR-225, provides an industry-standard way for Java programs to access XML data using XQuery.

Its expressions and their results are not necessarily XML data. It lets you evaluate XQuery expressions against XML data sources and process the results as XML data.

Base X offers a complete implementation of the XQuery Update Facility (XQUF).