<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Native XML Database</title>
	<atom:link href="http://nativexmldatabase.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nativexmldatabase.com</link>
	<description></description>
	<lastBuildDate>Fri, 03 May 2013 05:32:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='nativexmldatabase.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Native XML Database</title>
		<link>http://nativexmldatabase.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nativexmldatabase.com/osd.xml" title="Native XML Database" />
	<atom:link rel='hub' href='http://nativexmldatabase.com/?pushpress=hub'/>
		<item>
		<title>How to list all elements and attributes in DB2 for z/OS</title>
		<link>http://nativexmldatabase.com/2013/01/26/how-to-list-all-elements-and-attributes-in-db2-for-zos/</link>
		<comments>http://nativexmldatabase.com/2013/01/26/how-to-list-all-elements-and-attributes-in-db2-for-zos/#comments</comments>
		<pubDate>Sun, 27 Jan 2013 01:41:46 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1621</guid>
		<description><![CDATA[In a previous post I described how to write a query that produces a list of all elements and attributes that occur in a document or a set of documents.  The core idea of that technique was to use the XPath expression $doc//(*, @*) in the XMLTABLE function. In this expression, $doc references the XML [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1621&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In a <a href="http://nativexmldatabase.com/2010/05/26/xml-profiling-how-to-get-a-list-of-all-elements-and-attributes/">previous post</a> I described how to write a query that produces a list of all elements and attributes that occur in a document or a set of documents. </p>
<p>The core idea of that technique was to use the XPath expression <strong>$doc//(*, @*)</strong> in the XMLTABLE function. In this expression, <strong>$doc</strong> references the XML document or XML column that is used as input. This expression also uses the so-called comma operator that combines two squences into one. These two sequences are are all elements (*) and all attributes (@*).</p>
<p>For this technique to work in DB2 for z/OS, you need to code the XPath expression in a slightly different way:  (<strong>$doc//*,  $doc//@*)</strong>  , which lists all elements followed by all attributes.</p>
<p>It is useful to sort the result by the parent of each node in the document so that the elements and attributes that belong to the same parent appear in consecutive order in the result set.</p>
<p>The following listing shows two queries that produce the same result set, and the second of the two queries is the recommendad notation for DB2 for z/OS:</p>
<pre class="brush: sql; title: ; notranslate">

SELECT T.*
FROM purchaseorder p,
     XMLTABLE('$doc//(*, @*)' passing p.porder as &quot;doc&quot;
      COLUMNS
       node   VARCHAR(20) PATH 'name(.)',
       parent VARCHAR(20) PATH '../name(.)') AS T
WHERE poid = 5000
ORDER BY parent;

SELECT T.*
FROM purchaseorder p,
     XMLTABLE('($doc//*, $doc//@*)' passing p.porder as &quot;doc&quot;
      COLUMNS
       node   VARCHAR(20) PATH 'name(.)',
       parent VARCHAR(20) PATH '../name(.)') AS T
WHERE poid = 5000
ORDER BY parent;

</pre>
<p> And then you can ertainly extend such queries to also list the node values or an indication whether the node is an element or an attribute, as previously described <a href="http://nativexmldatabase.com/2010/05/26/xml-profiling-how-to-get-a-list-of-all-elements-and-attributes/">here</a>.</p>
<p>Similar considerations apply to queries that <a href="http://nativexmldatabase.com/2012/02/04/how-to-list-the-paths-of-all-elements-in-an-xml-document/">list all paths in a document</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1621/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1621/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1621&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2013/01/26/how-to-list-all-elements-and-attributes-in-db2-for-zos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>nativexmldatabase.com &#8211; 2008 to 2012</title>
		<link>http://nativexmldatabase.com/2012/12/28/nativexmldatabase-com-2008-to-2012/</link>
		<comments>http://nativexmldatabase.com/2012/12/28/nativexmldatabase-com-2008-to-2012/#comments</comments>
		<pubDate>Fri, 28 Dec 2012 12:35:02 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1601</guid>
		<description><![CDATA[This blog on XML database technology and DB2 pureXML has been active for almost 5 years now. My former colleage Conor O&#8217;Mahony ran this blog from early 2008 to December 2009, and I took over on Dec 15, 2009. We have received a lot of feedback and many of the blog posts were inspired by [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1601&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This blog on XML database technology and DB2 pureXML has been active for almost 5 years now. My former colleage Conor O&#8217;Mahony ran this blog from early 2008 to December 2009, and I took over on Dec 15, 2009. We have received a lot of feedback and many of the blog posts were inspired by questions from XML database users.</p>
<p>I&#8217;m not sure yet how much time I will have for blogging in 2013 and beyond. In any case, I liked the idea of producing a summary page that provides a quick overview of all the topics and posts in this blog. But, how to produce such a summary most efficiently?</p>
<p>Well, true to the topic of this blog I decided to load this blog as a piece of XML into DB2 pureXML and run queries on it!</p>
<p>First I downloaded the complete blog as an HTML document. But, HTML is not necessarily wellformed XML because HTML allows elements with missing end tags and other goofy things. Luckily there are free tools available that convert HTML into XHTML. XHTML is a form of HTML that complies with the rules for well-formed XML documents.</p>
<p>After converting the entire blog into an XML (XHTML) document, it took only three steps to create a list of blog post titles, dates, and URLs:</p>
<pre><span style="color:#0000ff;">CREATE TABLE nativexmldatabase(doc XML);

</span>
<span style="color:#0000ff;">LOAD FROM blog.del OF DEL REPLACE INTO nativexmldatabase(doc);

</span>
<span style="color:#0000ff;">SELECT date, title, url</span>
<span style="color:#0000ff;">FROM nativexmldatabase,</span>
<span style="color:#0000ff;">   XMLTABLE('$DOC//div[@class="entrytitle"]'</span>
<span style="color:#0000ff;">   COLUMNS</span>
<span style="color:#0000ff;">     seq     FOR ORDINALITY,</span>
<span style="color:#0000ff;">     date    VARCHAR(20)   PATH 'h3',</span>
<span style="color:#0000ff;">     title   VARCHAR(105)  PATH 'h2/a',</span>
<span style="color:#0000ff;">     url     VARCHAR(145)  PATH 'h2/a/@href') AS T;</span></pre>
<p>Of course, a quick look into the XML document is necessary to discover the required tag names and XPath expressions, such as <span style="color:#0000ff;">//div[@class="entrytitle"]</span> to iterate over all the individual posts, or <span style="color:#0000ff;">h2/a <span style="color:#000000;">and</span> h2/a/@href</span> to retrieve the title and URL of each post.</p>
<p>This query produces a nice list of all blog post titles, dates, and URLs. Instead of posting this listing as-is, I decided to roughly group the blog posts along the following topic areas:</p>
<p>* Design<br />
* Performance<br />
* Migration<br />
* Relational to XML or XML to relational<br />
* XML Queries<br />
* XML Storage and Indexing<br />
* XML Schemas<br />
* Application Development<br />
* Use Cases and Case Studies<br />
* ETL and Warehousing<br />
* DB2 pureXML Product News<br />
* Other Products and Tools<br />
* Publications and Resources<br />
* XML Coverage at IDUG and IOD Conferences<br />
* News, Announcements, Miscellaneous</p>
<p>And here is the result, a table of contents for nativexmldatabase.com from 2008 through 2012. I hope this can serve as a quick reference to topics of interest.</p>
<table border="1">
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td style="width:100px;">Date</td>
<td><strong>Design</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Dec 4, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/12/04/good-and-bad-xml-design/">Good and bad XML design</a></td>
</tr>
<tr>
<td>Jan 21, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/01/21/business-records-in-the-21st-century/">Business Records in the 21st Century</a></td>
</tr>
<tr>
<td>Jan 8, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/01/08/data-normalization-reconsidered/">Data Normalization Reconsidered</a></td>
</tr>
<tr>
<td>Jan 21, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/01/21/namevalue-pairs-a-pretty-bad-idea-in-xml-as-in-relational/">Name/Value Pairs &#8211; A pretty bad idea in XML as in Relational !</a></td>
</tr>
<tr>
<td>Jan 8, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/01/08/xml-manipulation-in-application-code-vs-a-native-xml-database/">XML Manipulation in Application code vs. a Native XML Database</a></td>
</tr>
<tr>
<td>Sep 28, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/09/28/5-reasons-for-storing-xml-in-a-database/">5 Reasons for Storing XML in a Database</a></td>
</tr>
<tr>
<td>Sep 26, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/26/flexible-schemas-when-to-persist-data-in-xml-instead-of-relational/">Flexible Schemas: When to Persist Data in XML Instead of Relational</a></td>
</tr>
<tr>
<td>Aug 4, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/08/04/when-to-store-in-xml-format/">When to Store in XML Format</a></td>
</tr>
<tr>
<td>Mar 21, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/03/21/when-to-use-a-native-xml-database/">When to use a Native XML Database</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>Performance</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Oct 23, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/10/23/overcoming-performance-obstacles-in-xml-encryption/">Overcoming Performance Obstacles in XML Encryption</a></td>
</tr>
<tr>
<td>Nov 15, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/11/15/tpox-2-1-has-been-released/">TPoX 2.1 has been released!</a></td>
</tr>
<tr>
<td>May 9, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/05/09/news-flash-intel-publishes-tpox-benchmark-results-on-new-10-core-westmere-ex-cpus/">News Flash: Intel publishes TPoX Benchmark results on new 10-core Westmere-EX CPUs</a></td>
</tr>
<tr>
<td>Mar 4, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/03/04/new-tpox-benchmark-results-available/">New TPoX Benchmark Results Available</a></td>
</tr>
<tr>
<td>Jan 8, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/01/08/xml-manipulation-in-application-code-vs-a-native-xml-database/">XML Manipulation in Application code vs. a Native XML Database</a></td>
</tr>
<tr>
<td>Aug 22, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/08/22/xml-versus-relational-database-performance/">XML versus Relational Database Performance</a></td>
</tr>
<tr>
<td>July 14, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/07/14/a-10tb-xml-data-warehouse-benchmark/">A 10TB XML Data Warehouse Benchmark</a></td>
</tr>
<tr>
<td>Nov 3, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/11/03/benchmark-for-1tb-transactional-xml-system/">Benchmark for 1TB Transactional XML System</a></td>
</tr>
<tr>
<td>Mar 20, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/03/20/native-xml-versus-clob-and-shredding/">Native XML versus CLOB and Shredding</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>Migration</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>June 29, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/06/29/how-to-migrate-from-the-xml-extender-to-db2-purexml/">How to migrate from the XML Extender to DB2 pureXML</a></td>
</tr>
<tr>
<td>Oct 3, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/10/03/how-to-migrate-xml-from-lob-to-xml-columns/">How to migrate XML from LOB to XML columns</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>Relational to XML or XML to relational</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Aug 30, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/08/30/xml-construction-in-views-and-user-defined-functions/">XML Construction in Views and User-Defined Functions</a></td>
</tr>
<tr>
<td>Aug 24, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/08/24/how-to-generate-xml-from-relational-data-with-line-breaks-2/">How to generate XML from relational data &#8211; with line breaks!</a></td>
</tr>
<tr>
<td>June 8, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/06/08/how-to-quickly-produce-xml-from-relational-tables/">How to quickly produce XML from relational tables</a></td>
</tr>
<tr>
<td>June 5, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/06/05/how-to-insert-relational-data-into-existing-xml-documents-part-2/">How to insert relational data into existing XML documents (Part 2)</a></td>
</tr>
<tr>
<td>May 21, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/05/21/how-to-add-relational-data-into-existing-xml-documents-part-1/">How to add relational data into existing XML documents (Part 1)</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>XML Queries</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Sep 13, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/09/13/how-to-validate-xml-documents-in-database-queries/">How to Validate XML Documents in Database Queries</a></td>
</tr>
<tr>
<td>Aug 14, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/08/14/result-set-cardinalities-when-querying-repeating-xml-elements/">Result set cardinalities when querying repeating XML elements</a></td>
</tr>
<tr>
<td>Aug 10, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/08/10/using-the-xmltable-function-with-merge-statements-in-db2-for-zos/">Using the XMLTABLE function with MERGE statements in DB2 for z/OS</a></td>
</tr>
<tr>
<td>July 30, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/07/30/using-the-xmltable-function-in-update-and-merge-statements/">Using the XMLTABLE function in UPDATE and MERGE statements</a></td>
</tr>
<tr>
<td>May 24, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/05/24/how-to-query-cdata-sections-in-xml/">How to query CDATA sections in XML</a></td>
</tr>
<tr>
<td>Feb 4, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/02/04/how-to-list-the-paths-of-all-elements-in-an-xml-document/">How to list the paths of all elements in an XML document?</a></td>
</tr>
<tr>
<td>Nov 30, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/11/30/xquery-support-in-db2-10-for-zos/">XQuery support in DB2 10 for z/OS</a></td>
</tr>
<tr>
<td>Oct 9, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/10/09/advanced-sqlxml-joins-and-flwor-expressions-in-the-xmltable-function/">Advanced SQL/XML: Joins and FLWOR Expressions in the XMLTABLE Function</a></td>
</tr>
<tr>
<td>Aug 29, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/08/29/quantified-expressions-in-xquery-when-some-and-every-satisfy/">Quantified expressions in XQuery: When &#8216;some&#8217; and &#8216;every&#8217; satisfy!</a></td>
</tr>
<tr>
<td>Mar 18, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/03/18/xquery-and-sqlxml-how-to-convert-a-date-that-is-not-a-date-into-a-date/">XQuery and SQL/XML: How to convert a date that is not a date into a date?</a></td>
</tr>
<tr>
<td>Aug 11, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/08/11/how-to-order-query-results-based-on-xml-values/">How to order query results based on XML values</a></td>
</tr>
<tr>
<td>May 26, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/05/26/xml-profiling-how-to-get-a-list-of-all-elements-and-attributes/">XML Profiling &#8211; How to get a list of all elements and attributes</a></td>
</tr>
<tr>
<td>May 9, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/05/09/how-to-deal-with-dirty-data/">How to deal with dirty data</a></td>
</tr>
<tr>
<td>July 24, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/07/24/xquery-and-other-xml-manipulation-in-sql-stored-procedures/">XQuery and Other XML Manipulation in SQL Stored Procedures</a></td>
</tr>
<tr>
<td>April 6, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/04/06/returning-data-from-one-path-based-on-predicates-in-another-part-22/">Returning data from one path based on predicates in another (part 2/2)</a></td>
</tr>
<tr>
<td>April 3, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/04/03/intra-document-references-returning-data-from-one-path-depending-on-predicates-in-another-path/">Intra-document references: Returning data from one path depending on predicates in another path</a></td>
</tr>
<tr>
<td>June 17, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/06/17/an-xquery-cheat-sheet/">An XQuery Cheat Sheet</a></td>
</tr>
<tr>
<td>April 12, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/04/12/the-xmltable-function-and-a-case-where-a-left-outer-join-can-help/">The XMLTABLE function and a case where a left outer join can help</a></td>
</tr>
<tr>
<td>Feb 21, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/02/21/get-started-with-xml-full-text-search-in-db2/">Get Started with XML Full-Text Search in DB2</a></td>
</tr>
<tr>
<td>Jan 25, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/01/25/tokenize-it/">tokenize it !</a></td>
</tr>
<tr>
<td>Jan 11, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/01/11/watch-your-step-positional-predicates-in-xpath/">Watch your step! Positional predicates in XPath.</a></td>
</tr>
<tr>
<td>Oct 14, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/10/14/xquery-introduction-tips-and-future-directions/">XQuery: Introduction, Tips, and Future Directions</a></td>
</tr>
<tr>
<td>July 25, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/07/25/xquery-versus-sqlxml-part-deux/">XQuery versus SQL/XML &#8211; Part Deux</a></td>
</tr>
<tr>
<td>June 26, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/06/26/xquery-versus-sqlxml/">XQuery versus SQL/XML</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>XML Storage and Indexing</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>July 11, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/07/11/xml-storage-in-db2-to-inline-or-not-to-inline/">XML Storage in DB2: To inline or not to inline?</a></td>
</tr>
<tr>
<td>June 8, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/06/08/xml-indexing-in-db2-9-x-and-db2-10-for-linux-unix-windows/">XML Indexing in DB2 9.x and DB2 10 for Linux, UNIX, and Windows</a></td>
</tr>
<tr>
<td>July 11, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/07/11/how-to-index-xml-documents-in-the-presence-of-schema-diversity/">How to index XML documents in the presence of schema diversity?</a></td>
</tr>
<tr>
<td>July 19, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/07/19/structure-agnostic-xml-indexes-in-db2/">Structure-agnostic XML indexes in DB2</a></td>
</tr>
<tr>
<td>Dec 26, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/12/26/how-to-insert-xml-documents-from-the-file-system/">How to insert XML documents from the file system?</a></td>
</tr>
<tr>
<td>Feb 21, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/02/21/get-started-with-xml-full-text-search-in-db2/">Get Started with XML Full-Text Search in DB2</a></td>
</tr>
<tr>
<td>May 6, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/05/06/db2-compresses-xml-data-by-60-to-80/">DB2 Compresses XML Data by 60% to 80%</a></td>
</tr>
<tr>
<td>May 3, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/05/03/multi-dimensional-clustering-for-tables-with-native-xml-data/">Multi-Dimensional Clustering for Tables with Native XML Data</a></td>
</tr>
<tr>
<td>May 1, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/05/01/use-hash-partitioning-for-fast-analysis-of-xml-data/">Use Hash Partitioning for Fast Analysis of XML Data</a></td>
</tr>
<tr>
<td>Oct 16, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/10/16/dba-concerns-about-native-xml-storage/">DBA Concerns about Native XML Storage</a></td>
</tr>
<tr>
<td>April 8, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/04/08/examples-of-native-xml-reducing-storage-costs/">Native XML Reduces Storage Costs</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>XML Schemas</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Sep 13, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/09/13/how-to-validate-xml-documents-in-database-queries/">How to Validate XML Documents in Database Queries</a></td>
</tr>
<tr>
<td>Feb 29, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/02/29/what-is-an-xml-schema-and-why-should-i-care/">What is an XML Schema and why should I care?</a></td>
</tr>
<tr>
<td>Aug 22, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/08/22/schema-evolution/">Schema Evolution</a></td>
</tr>
<tr>
<td>Aug 21, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/08/21/schema-flexibility/">Schema Flexibility</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>Application Development</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Sep 29, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/09/29/rest-with-db2-purexml/">At your service: REST with DB2 pureXML!</a></td>
</tr>
<tr>
<td>Aug 8, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/08/08/using-xquery-across-application-server-and-database-server/">Using XQuery across Application Server and Database Server</a></td>
</tr>
<tr>
<td>July 30, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/07/30/beyond-the-database-native-xml-and-xquery-in-the-application-server/">Beyond the Database: Native XML and XQuery in the Application Server</a></td>
</tr>
<tr>
<td>Feb 25, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/02/25/cics-meets-xml-using-cics-web-servives-with-db2-purexml/">CICS meets XML: Using CICS Web Servives with DB2 pureXML</a></td>
</tr>
<tr>
<td>Jan 8, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/01/08/xml-manipulation-in-application-code-vs-a-native-xml-database/">XML Manipulation in Application code vs. a Native XML Database</a></td>
</tr>
<tr>
<td>Oct 8, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/10/08/buidling-xml-solutions-with-rational-software-architect-rsa-and-rational-application-developer-rda/">Buidling XML Solutions with Rational Software Architect (RSA) and Rational Application Dev</a></td>
</tr>
<tr>
<td>Mar 1, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/03/01/xml-support-in-jdbc-4-0-the-sqlxml-interface/">XML Support in JDBC 4.0: The SQLXML Interface</a></td>
</tr>
<tr>
<td>Nov 9, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/11/09/building-a-json-and-db2-purexml-application/">Building a JSON and DB2 pureXML Application</a></td>
</tr>
<tr>
<td>Aug 5, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/08/05/native-xml-storage-reduces-development-costs/">Native XML Storage Reduces Development Costs</a></td>
</tr>
<tr>
<td>Nov 18, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/11/18/referential-integrity-and-xml-data/">Referential Integrity and XML Data</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>XML Use Cases and Case Studies</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Sep 12, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/09/12/db2-purexml-rich-in-proteins/">DB2 pureXML &#8211; Rich in Proteins!</a></td>
</tr>
<tr>
<td>June 24, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/06/24/a-true-story-about-using-xml-forms-and-db2-to-process-millions-of-tax-returns/">A true story about using XML forms and DB2 to process millions of tax returns</a></td>
</tr>
<tr>
<td>May 12, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/05/12/webcast-on-xml-use-cases-may-18/">Webcast on XML Use Cases (May 18)</a></td>
</tr>
<tr>
<td>Feb 7, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/02/07/bjc-healthcare-improves-clinical-research-with-db2-purexml/">BJC HealthCare Improves Clinical Research with DB2 pureXML</a></td>
</tr>
<tr>
<td>Nov 2, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/11/02/electronic-forms-using-adobe-pdf-and-ibm-db2-purexml/">Electronic Forms Using Adobe PDF and IBM DB2 pureXML</a></td>
</tr>
<tr>
<td>Sep 8, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/09/08/the-patient-centered-medical-home/">The Patient-Centered Medical Home</a></td>
</tr>
<tr>
<td>Aug 24, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/08/24/electronic-health-records-for-smarter-healthcare/">Electronic Health Records for Smarter Healthcare</a></td>
</tr>
<tr>
<td>July 17, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/07/17/article-about-xml-for-healthcare/">Article about XML for Healthcare</a></td>
</tr>
<tr>
<td>June 16, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/06/16/building-an-xml-based-electronic-forms-solution/">Building an XML-Based Electronic Forms Solution</a></td>
</tr>
<tr>
<td>June 5, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/06/05/short-video-highlighting-early-experiences-with-db2-9-7/">Short Video Highlighting Early Experiences with DB2 9.7</a></td>
</tr>
<tr>
<td>Mar 30, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/03/30/gus-group-uses-db2-purexml-for-erp-system/">GUS Group uses DB2 pureXML for ERP System</a></td>
</tr>
<tr>
<td>Mar 13, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/03/13/ucla-health-system-uses-xml-and-soa-to-optimize-data-integration-and-migration/">UCLA Health System uses XML and SOA to Optimize Data Integration and Migration</a></td>
</tr>
<tr>
<td>Mar 2, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/03/02/storing-and-retrieving-acord-data-for-insurance/">Storing and Retrieving ACORD Data for Insurance</a></td>
</tr>
<tr>
<td>Feb 26, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/02/26/speedy-communications-and-collaboration-in-xml-based-environments/">Speedy Communications and Collaboration in XML-based Environments</a></td>
</tr>
<tr>
<td>Dec 30, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/12/30/xforms-and-native-xml-storage/">XForms and Native XML Storage</a></td>
</tr>
<tr>
<td>Mar 27, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/03/27/how-to-choose-solution-areas/">How to Choose Solution Areas</a></td>
</tr>
<tr>
<td>Mar 25, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/03/25/more-information-about-storebrand/">More information about Storebrand</a></td>
</tr>
<tr>
<td>Mar 23, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/03/23/productivity-improvements-at-storebrand/">Productivity Improvements at Storebrand</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>ETL and Warehousing</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>April 13, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/04/13/xml-etl-with-datastage-8-5/">XML ETL with DataStage 8.5</a></td>
</tr>
<tr>
<td>July 14, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/07/14/a-10tb-xml-data-warehouse-benchmark/">A 10TB XML Data Warehouse Benchmark</a></td>
</tr>
<tr>
<td>June 23, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/06/23/more-on-data-warehousing-and-xml/">More on Data Warehousing and XML</a></td>
</tr>
<tr>
<td>April 5, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/04/05/more-on-xml-etl/">More on XML ETL</a></td>
</tr>
<tr>
<td>Mar 26, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/03/26/xml-etl/">XML ETL</a></td>
</tr>
<tr>
<td>Jan 31, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/01/31/new-article-on-xml-in-the-data-warehouse/">New Article on XML in the Data Warehouse</a></td>
</tr>
<tr>
<td>May 28, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/05/28/matthias-nicola-on-xml-in-the-data-warehouse/">XML in the Data Warehouse</a></td>
</tr>
<tr>
<td>April 22, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/04/22/fast-performance-for-native-xml-data-in-the-warehouse/">Fast Performance for Native XML Data in the Warehouse</a></td>
</tr>
<tr>
<td>Aug 24, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/08/24/article-on-integrating-xml-operational-data-into-a-data-warehouse/">Article on Integrating XML Operational Data into a Data Warehouse</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>DB2 pureXML product news</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>April 19, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/04/19/xml-enhancements-in-db2-10-for-linux-unix-and-windows/">XML Enhancements in DB2 10 for Linux, UNIX, and Windows</a></td>
</tr>
<tr>
<td>Nov 30, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/11/30/node-level-xml-updates-in-db2-10-for-zos/">Node-level XML Updates in DB2 10 for z/OS</a></td>
</tr>
<tr>
<td>Nov 18, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/11/18/new-xml-features-in-db2-10-for-zos/">New XML Features in DB2 10 for z/OS !</a></td>
</tr>
<tr>
<td>June 8, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/06/08/updated-version-of-a-free-xml-database-db2-express-c-9-7-2/">Updated version of a free XML database: DB2 Express-C 9.7.2</a></td>
</tr>
<tr>
<td>Aug 7, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/08/07/soa-projects-ibm-db2-versus-oracle-database/">SOA Projects: IBM DB2 versus Oracle Database</a></td>
</tr>
<tr>
<td>Feb 11, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/02/11/xml-database-in-the-cloud/">XML Database in the Cloud</a></td>
</tr>
<tr>
<td>Feb 10, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/02/10/purexml-moves-into-core-db2-product/">pureXML Moves into Core DB2 Product</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>Other Products and Tools</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Dec 5, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/12/05/xml-tools-for-db2-purexml/">XML Tools for DB2 pureXML</a></td>
</tr>
<tr>
<td>Mar 8, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/03/08/integration-of-altova-xmlspy-with-db2-purexml/">Integration of Altova XMLSpy with DB2 pureXML</a></td>
</tr>
<tr>
<td>Jan 18, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/01/18/xpath-and-xquery-functions-in-sql-server-vs-db2/">XPath and XQuery Functions in SQL Server vs. DB2</a></td>
</tr>
<tr>
<td>Jan 4, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/01/04/shredding-and-constructing-xml-in-mysql/">Shredding and constructing XML in mySQL</a></td>
</tr>
<tr>
<td>Dec 23, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/12/23/xml-support-in-mysql/">XML Support in mySQL</a></td>
</tr>
<tr>
<td>Dec 17, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/12/17/oracle-vs-mysql-the-full-monty%e2%80%a6/">Oracle vs. mySQL: The Full Monty</a></td>
</tr>
<tr>
<td>Aug 7, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/08/07/mycareteam-and-ibm-collaborate-to-improve-continuing-care-for-diabetes/">MyCareTeam and IBM Collaborate to Improve Continuing Care for Diabetes</a></td>
</tr>
<tr>
<td>July 8, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/07/08/why-wont-oracle-benchmark-xml/">Why Won&#8217;t Oracle Publish XML Benchmark Results for TPoX?</a></td>
</tr>
<tr>
<td>Sep 30, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/30/xml-in-oracle-11g/">XML in Oracle 11g</a></td>
</tr>
<tr>
<td>Sep 24, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/24/xml-in-sql-server-2008/">XML in SQL Server 2008</a></td>
</tr>
<tr>
<td>Sep 19, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/19/xml-in-sql-server-2005/">XML in SQL Server 2005</a></td>
</tr>
<tr>
<td>July 11, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/07/11/questions-for-xml-database-vendors/">Questions for XML Database Vendors</a></td>
</tr>
<tr>
<td>May 13, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/05/13/xml-only-databases/">XML-only Databases</a></td>
</tr>
<tr>
<td>May 12, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/05/12/all-native-xml-databases-are-not-equal/">All Native XML Databases are not Equal</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>Publications and Resources</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Feb 13, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/02/13/extremely-purexml-in-db2-10-for-zos/">Extremely pureXML in DB2 10 for z/OS</a></td>
</tr>
<tr>
<td>Sep 14, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/09/14/db2-purexml-cookbook-errata/">DB2 pureXML Cookbook &#8211; Errata</a></td>
</tr>
<tr>
<td>Aug 13, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/08/13/db2-purexml-cookbook-45-discount/">DB2 pureXML Cookbook &#8211; 45% Discount</a></td>
</tr>
<tr>
<td>June 3, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/06/03/db2-purexml-for-dummies-get-your-copy/">DB2 pureXML for Dummies . Get Your Copy!</a></td>
</tr>
<tr>
<td>April 29, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/04/29/get-off-to-a-fast-start-with-db2-purexml/">Get off to a fast start with DB2 pureXML</a></td>
</tr>
<tr>
<td>April 10, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/04/10/db2-purexml-cookbook/">DB2 pureXML Cookbook</a></td>
</tr>
<tr>
<td>Feb 25, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/02/25/intel-insights-magazine-covers-native-xml-storage/">Intel Insights Magazine covers Native XML Storage</a></td>
</tr>
<tr>
<td>Feb 5, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/02/05/henriks-blog/">Henrik&#8217;s Blog</a></td>
</tr>
<tr>
<td>Feb 5, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/02/05/db2-purexml-leads-soa-world-magazine-readers-choice-award/">DB2 pureXML leads SOA World Magazine Reader&#8217;s Choice Award</a></td>
</tr>
<tr>
<td>Jan 21, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/01/21/podcast-series-about-db2-purexml-on-the-mainframe/">Podcast Series about DB2 pureXML on the Mainframe</a></td>
</tr>
<tr>
<td>Jan 20, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/01/20/reports-for-information-in-native-xml-format/">Reports for Information in Native XML Format</a></td>
</tr>
<tr>
<td>Dec 30, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/12/30/anant-jhingran-on-improving-xml-applications/">Anant Jhingran on Improving XML Applications</a></td>
</tr>
<tr>
<td>Sep 1, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/01/db2-purexml-online-communities/">DB2 pureXML Online Communities</a></td>
</tr>
<tr>
<td>July 27, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/07/27/getting-started-with-native-xml-databases/">Getting Started with Native XML Databases</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>XML Coverage at IDUG and IOD Conferences</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>Oct 21, 2012</td>
<td><a href="http://nativexmldatabase.com/2012/10/21/xml-from-vegas-to-berlin/">XML from Vegas to Berlin!</a></td>
</tr>
<tr>
<td>Oct 18, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/10/18/xml-in-las-vegas/">XML in Las Vegas !</a></td>
</tr>
<tr>
<td>April 25, 2011</td>
<td><a href="http://nativexmldatabase.com/2011/04/25/xml-sessions-at-idug-north-america-2011/">XML sessions at IDUG North America 2011</a></td>
</tr>
<tr>
<td>Oct 21, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/10/21/next-week-in-vegas/">Next week in Vegas</a></td>
</tr>
<tr>
<td>April 18, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/04/18/db2-for-zos-purexml-hands-on-lab-idug-north-america/">DB2 for z/OS pureXML Hands-on Lab @ IDUG North America</a></td>
</tr>
<tr>
<td>Oct 23, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/10/23/db2-purexml-at-the-iod-conference-2/">DB2 pureXML at the IOD Conference</a></td>
</tr>
<tr>
<td>May 28, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/05/28/ibm-iod-conference-attendees-get-a-poken-for-networking/">IBM IOD Conference Attendees get a Poken for Networking</a></td>
</tr>
<tr>
<td>May 13, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/05/13/short-video-from-the-idug-north-america-confernece/">Short Video from the IDUG North America Confernece</a></td>
</tr>
<tr>
<td>Nov 11, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/11/11/xml-at-ibm-information-on-demand-conference/">XML at IBM Information on Demand Conference</a></td>
</tr>
<tr>
<td>Sep 11, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/11/db2-purexml-at-the-iod-conference/">DB2 pureXML at the IOD Conference</a></td>
</tr>
<tr>
<td>Sep 4, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/04/meet-native-xml-databases-users/">Meet Native XML Databases Users</a></td>
</tr>
<tr>
<td height="20"></td>
<td height="20"></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:lightgray;">
<tr>
<td>Date</td>
<td><strong>News, Announcements, Miscellaneous</strong></td>
</tr>
</tbody>
<tbody style="font-family:verdana;background-color:white;">
<tr>
<td>July 30, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/07/30/db2-express-c-light-a-reduced-footprint-xml-database/">DB2 Express-C Light &#8211; A reduced footprint XML database</a></td>
</tr>
<tr>
<td>Mar 15, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/03/15/more-db2-purexml-bootcamps/">More DB2 pureXML Bootcamps</a></td>
</tr>
<tr>
<td>Feb 14, 2010</td>
<td><a href="http://nativexmldatabase.com/2010/02/14/db2-purexml-webinars-and-bootcamps/">DB2 pureXML Webinars and Bootcamps</a></td>
</tr>
<tr>
<td>Dec 15, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/12/15/hi-there%e2%80%a6-here-is-the-new-guy/">Hi there here is the new guy!</a></td>
</tr>
<tr>
<td>Dec 13, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/12/13/welcome-matthias-nicola/">Welcome Matthias Nicola!</a></td>
</tr>
<tr>
<td>June 9, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/06/09/flirting-with-poken/">Flirting with Poken</a></td>
</tr>
<tr>
<td>April 22, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/04/22/the-xml-rap-superstar/">The XML Rap Superstar</a></td>
</tr>
<tr>
<td>April 22, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/04/22/idug-announces-winners-of-xml-challenge/">IDUG announces winners of XML Challenge</a></td>
</tr>
<tr>
<td>April 20, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/04/20/teaser-for-upcoming-db2-purexml-features/">Teaser for Upcoming DB2 pureXML Features</a></td>
</tr>
<tr>
<td>Mar 12, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/03/12/db2-and-cloud-computing-chat-with-the-labs/">DB2 and Cloud Computing &#8211; Chat with the Labs</a></td>
</tr>
<tr>
<td>Feb 5, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/02/05/free-online-conference-data-in-action/">Free Online Conference &#8211; Data in Action</a></td>
</tr>
<tr>
<td>Jan 20, 2009</td>
<td><a href="http://nativexmldatabase.com/2009/01/20/db2-technology-sandbox/">DB2 Technology Sandbox</a></td>
</tr>
<tr>
<td>Dec 26, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/12/26/native-xml-storage-for-the-mac/">Native XML Storage for the Mac</a></td>
</tr>
<tr>
<td>Dec 3, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/12/03/update-on-the-xml-challenge/">Update on the XML Challenge</a></td>
</tr>
<tr>
<td>Nov 5, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/11/05/why-ibm-db2-is-ideal-for-transactional-xml/">Why IBM DB2 is ideal for Transactional XML</a></td>
</tr>
<tr>
<td>Oct 9, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/10/09/10-reasons-why-dbas-should-understand-native-xml/">10 Reasons why DBAs Should Understand Native XML</a></td>
</tr>
<tr>
<td>Oct 2, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/10/02/xml-challenge-web-site-is-live/">XML Challenge Web Site is Live!</a></td>
</tr>
<tr>
<td>Sep 28, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/09/28/1st-Oct-is-online-community-action-day/">1st Oct is Online Community Action Day</a></td>
</tr>
<tr>
<td>Aug 7, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/08/07/webcast-a-primer-for-storing-and-retrieving-xml-data/">Webcast: A primer for storing and retrieving XML data</a></td>
</tr>
<tr>
<td>July 1, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/07/01/viral-video-wednesday/">Viral Video &#8211; Wednesday</a></td>
</tr>
<tr>
<td>June 20, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/06/20/viral-video-tuesday/">Viral Video &#8211; Tuesday</a></td>
</tr>
<tr>
<td>June 16, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/06/16/viral-video-pitch-meeting/">Viral Video &#8211; Monday</a></td>
</tr>
<tr>
<td>June 13, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/06/13/learn-to-use-xml-with-databases-and-win-prizes/">Learn to Use XML with Databases and win Prizes!</a></td>
</tr>
<tr>
<td>Mar 22, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/03/22/how-to-market-new-technology/">How to Market New Technology</a></td>
</tr>
<tr>
<td>Mar 19, 2008</td>
<td><a href="http://nativexmldatabase.com/2008/03/19/welcome/">Welcome</a></td>
</tr>
</tbody>
</table>
<p>Happy browsing!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1601/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1601&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/12/28/nativexmldatabase-com-2008-to-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>Good and bad XML design</title>
		<link>http://nativexmldatabase.com/2012/12/04/good-and-bad-xml-design/</link>
		<comments>http://nativexmldatabase.com/2012/12/04/good-and-bad-xml-design/#comments</comments>
		<pubDate>Wed, 05 Dec 2012 07:35:18 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1589</guid>
		<description><![CDATA[Whenever people design things &#8211;such as houses, software systems, database schemas, or even XML structures&#8211; there are good and not so good design options.  Roughly speaking, a design is usually considered &#8220;good&#8221; if it allows for easy and (cost-)efficient use and implementation of whatever is being built. For XML documents we have seen various cases [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1589&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Whenever people design things &#8211;such as houses, software systems, database schemas, or even XML structures&#8211; there are good and not so good design options.  Roughly speaking, a design is usually considered &#8220;good&#8221; if it allows for easy and (cost-)efficient use and implementation of whatever is being built.</p>
<p>For XML documents we have seen various cases of &#8220;good&#8221; and &#8220;bad&#8221; designs over the years. Previously I wrote about <a href="http://nativexmldatabase.com/2011/01/21/namevalue-pairs-a-pretty-bad-idea-in-xml-as-in-relational/">name/value pair design for XML documents</a>, which often is not a good choice.</p>
<p>Recently I received a question regarding another design choice, which I would like to share here in a simplified form.</p>
<p>The question was about an XML message format to transmit a list of order numbers and the corresponding order system identifiers. Two alternative XML structures were proposed:</p>
<p>Option A:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;OrderList&gt;
  &lt;Order&gt;
    &lt;OrderNumber&gt;A0000001&lt;/OrderNumber&gt;
    &lt;OrderSystem&gt;ABC&lt;/OrderSystem&gt;
  &lt;/Order&gt;
  &lt;Order&gt;
    &lt;OrderNumber&gt;B0000001&lt;/OrderNumber&gt;
    &lt;OrderSystem&gt;XP1&lt;/OrderSystem&gt;
  &lt;/Order&gt;
  &lt;Order&gt;
    &lt;OrderNumber&gt;C0000001&lt;/OrderNumber&gt;
    &lt;OrderSystem&gt;Q-9&lt;/OrderSystem&gt;
  &lt;/Order&gt;
&lt;/OrderList&gt;

</pre>
<p>Option B:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;OrderList&gt;
    &lt;OrderNumber&gt;A0000001&lt;/OrderNumber&gt;
    &lt;OrderSystem&gt;ABC&lt;/OrderSystem&gt;
    &lt;OrderNumber&gt;B0000001&lt;/OrderNumber&gt;
    &lt;OrderSystem&gt;XP1&lt;/OrderSystem&gt;
    &lt;OrderNumber&gt;C0000001&lt;/OrderNumber&gt;
    &lt;OrderSystem&gt;Q-9&lt;/OrderSystem&gt;
&lt;/OrderList&gt;

</pre>
<p>The motivation for option B might be a smaller message size. One might argue that XML elements are by definition ordered, and if we know that the message consists of pairs of order number and order system, then XML format B is as easy to interpret as format A. Or, is it <em>not</em>?</p>
<p>The problem that I see with option B is that the absence of the &lt;Order&gt; elements gives up the <strong>explicit</strong> structure of the data and instead requires <strong>implicit</strong> knowledge, i.e. one must know that the OrderNumber at position i belongs to the OrderSystem at position i+1.</p>
<p>In my view, this design is against the principles of XML. In XML, the tags and their nesting should describe the data <em>explicitly</em>. XML is meant to be a hierarchical data format so that data items that belong together are grouped under the same parent (as in option A). After all, that is the benefit of XML over a flat file format.</p>
<p>I also think that using the explicit structure of option A is less error-prone than using option B which, requires implicit knowledge based on element positions.</p>
<h3>How about queryability?</h3>
<p>It turns out that XML format A is considerably easier to query than option B. Let&#8217;s assume you need to code a SQL/XML query to list the order numbers and systems. For that exercise we assume that the messages are stored in a table &#8220;mytable&#8221; with XML column &#8220;doc&#8221;.</p>
<p>The query for XML option A is very simple, using the XMLTABLE function in its most basic form. The row-generating XPath expression $DOC/OrderList/Order iterates over the orders, and the column expressions extract the order number and system.</p>
<p><a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0708nicola/" rel="nofollow">http://www.ibm.com/developerworks/data/library/techarticle/dm-0708nicola/</a></p>
<pre class="brush: sql; title: ; notranslate">
-- Query for XML option A:

SELECT OrderNumber, OrderSystem
FROM mytable,
     XMLTABLE ('$DOC/OrderList/Order'
       COLUMNS
         OrderSystem VARCHAR(20) PATH 'OrderSystem',
         OrderNumber VARCHAR(20) PATH 'OrderNumber' );

ORDERNUMBER          ORDERSYSTEM
-------------------- --------------------
A0000001             ABC
B0000001             XP1
C0000001             Q-9

3 record(s) selected.

</pre>
<p>How can you produce the same result set from XML format B? This is remarkably tricky! You need to iterate over the child elements and keep track of which element is at position i versus i+1 to produce the proper pairs in the output.</p>
<p>There are likely several ways to code the query for XML option B, and you see one solution below. It seems hard to query the elements by name alone because the important structural information is by position. Hence, this query iterates over the positions 1 to N, where N is the number of elements. For each even position 2, 4, 6, etc. the query produces the pair of the current ($pos) and the previous ($pos &#8211; 1) element to construct the proper output.</p>
<pre class="brush: sql; title: ; notranslate">
-- Query for XML option B:

SELECT OrderNumber, OrderSystem
FROM mytable,
     XMLTABLE('for $pos in (1 to count($DOC/OrderList/*))
               where $pos mod 2 = 0
               return  &lt;pair&gt;
                         {$DOC/OrderList/*[$pos - 1]}
                         {$DOC/OrderList/*[$pos]}
                       &lt;/pair&gt;'
       COLUMNS
         OrderNumber VARCHAR(20) PATH 'OrderNumber',
         OrderSystem VARCHAR(20) PATH 'OrderSystem' );

OrderSYSTEM          OrderNUMBER
-------------------- --------------------
ABC                  A0000001
XP1                  B0000001
Q-9                  C0000001

3 record(s) selected.

</pre>
<p>This query is not only more complex but also potentially less efficient. Note that the return clause of the FLOWR expresion constructs the explicit pairing that it missing in XML format B.</p>
<p>Let me know if you can think of a simpler query to produce the same result from XML format B.</p>
<p>Next, imagine a message that doesn&#8217;t have just 2 fields per order but maybe 10 or 100 fields per order. Then option B becomes increasingly more ugly.</p>
<p>Or worse, what if there is a schema change that allows one order to have a different number of fields than the next? Then the query that we coded for XML format B will no longer work because it was based on a specific structural assumption that is no longer true. In contrast, our query for XML format A will work even if you add additional fields to some of the orders in the message.</p>
<p>In summary, the benefits for XML option A include the following:</p>
<ul>
<li>Explicit structure rather than implicit positional format</li>
<li>Easier and more efficient to query (query by name rather query by postion)</li>
<li>More resilient to schema changes</li>
</ul>
<p>I think that these benefits far outweigh the concern that XML format A is larger. Also, you could chose to send or store the XML in a compressed format to greatly alleviate space concerns.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1589/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1589&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/12/04/good-and-bad-xml-design/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>Overcoming Performance Obstacles in XML Encryption</title>
		<link>http://nativexmldatabase.com/2012/10/23/overcoming-performance-obstacles-in-xml-encryption/</link>
		<comments>http://nativexmldatabase.com/2012/10/23/overcoming-performance-obstacles-in-xml-encryption/#comments</comments>
		<pubDate>Tue, 23 Oct 2012 21:55:21 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1579</guid>
		<description><![CDATA[In times of data leakage, hacker attacks, trojan horses, and various other data security threats, efficient and effective data encryption has becomes a critical requirement for many enterprises. This need applies to XML as much as to most other forms of data. Intel and IBM have collaborated to demonstrate that a combination of modern hardware [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1579&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In times of data leakage, hacker attacks, trojan horses, and various other data security threats, efficient and effective data encryption has becomes a critical requirement for many enterprises. This need applies to XML as much as to most other forms of data.</p>
<p>Intel and IBM have collaborated to demonstrate that a combination of modern hardware and software can perform effective encryption with very high efficiency.</p>
<p>In particular, the latest Intel Xeon E5 and E7 processor families provide AES-NI, which is a set of new instructions in the Intel Xeon processor that help accelerate encryption, decryption, key generation, matrix manipulation, and carry-less multiplication.</p>
<p>A joint benchmark has measured the performance impact of encrypting and decrypting XML data in DB2 9.7 using the IBM InfoSphere Guardium Data Encryption capabilities on the Intel Xeon E5 platform.</p>
<p>The results of the TPoX benchmark show that full encryption can be performed for a read/write XML transaction processing application with less than 4% overhead. This is a fantastic result.</p>
<p><a href="http://purexml.files.wordpress.com/2012/10/figure1_intel_aes_v3.png"><img class="aligncenter size-full wp-image-1583" title="figure1_Intel_AES_v3" alt="" src="http://purexml.files.wordpress.com/2012/10/figure1_intel_aes_v3.png?w=480"   /></a></p>
<p>More information on these tests and on the technologies and products used, is available here:</p>
<p><a href="http://software.intel.com/en-us/articles/overcoming-performance-obstacles-in-data-encryption">http://software.intel.com/en-us/articles/overcoming-performance-obstacles-in-data-encryption</a></p>
<p><a href="http://software.intel.com/sites/default/files/m/d/4/1/d/8/IBM_DMM_Intel_AES_Vormetric_FINAL.pdf">http://software.intel.com/sites/default/files/m/d/4/1/d/8/IBM_DMM_Intel_AES_Vormetric_FINAL.pdf</a></p>
<p><a href="http://ibmdatamag.com/2012/05/overcoming-performance-obstacles-in-data-encryption/">http://ibmdatamag.com/2012/05/overcoming-performance-obstacles-in-data-encryption/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1579/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1579&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/10/23/overcoming-performance-obstacles-in-xml-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>

		<media:content url="http://purexml.files.wordpress.com/2012/10/figure1_intel_aes_v3.png" medium="image">
			<media:title type="html">figure1_Intel_AES_v3</media:title>
		</media:content>
	</item>
		<item>
		<title>XML from Vegas to Berlin!</title>
		<link>http://nativexmldatabase.com/2012/10/21/xml-from-vegas-to-berlin/</link>
		<comments>http://nativexmldatabase.com/2012/10/21/xml-from-vegas-to-berlin/#comments</comments>
		<pubDate>Sun, 21 Oct 2012 18:10:11 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1574</guid>
		<description><![CDATA[I&#8217;m in Las Vegas right now, this glittering and crazy city in Nevada! Las Vegas is once again the location for IBM&#8217;s annual Information On Demand (IOD) conference, which is starting today! IOD is the premier IBM event for Information Management software, including DB2, Informix, Netezza, Cognos, Big Data, SPSS, Content Maagement, and other product [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1574&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m in Las Vegas right now, this glittering and crazy city in Nevada! Las Vegas is once again the location for IBM&#8217;s annual <a href="http://www-01.ibm.com/software/data/2012-conference/">Information On Demand (IOD) conference</a>, which is starting today!</p>
<p>IOD is the premier IBM event for Information Management software, including DB2, Informix, Netezza, Cognos, Big Data, SPSS, Content Maagement, and other product areas. The conference program is very diverse and has something for everyone. At IOD you can choose from more than 1500 sessions and 100+ hands-on labs.</p>
<p>Not surprisingly, XML continues to be an important topic for information management, and there are various XML-related sessions at IOD. In particular, I&#8217;m looking forward to the following sessions where some of IBM&#8217;s customers are sharing their success stories with DB2 pureXML:</p>
<p><span style="color:#0000ff;">Session 3674A: </span><br />
<strong><span style="color:#0000ff;">IBM pureXML in Financial Applications: Experiences From Vanguard</span></strong><br />
<span style="color:#0000ff;">Mon, Oct 22, 201, 11:30 AM &#8211; 12:30 PM</span><br />
<span style="color:#0000ff;">Speakers: George White and Milton Beaver, The Vanguard Group</span></p>
<p><span style="color:#0000ff;">Sessio 1284B: </span><br />
<strong><span style="color:#0000ff;">IBM DB2 and XML: Excellent Opportunity or Extra Problems? Are You Ready?</span></strong><br />
<span style="color:#0000ff;">Mon, Oct 22, 2012, 2:15 PM &#8211; 3:15 PM</span><br />
<span style="color:#0000ff;">Speaker: Kurt Struyf, suadasoft</span></p>
<p><span style="color:#0000ff;">Session 1613A: </span><br />
<strong><span style="color:#0000ff;">How to Get Warehouse-Type Performance With XML Tables</span></strong><br />
<span style="color:#0000ff;">Wed, Oct 24, 2012, 2:30 PM &#8211; 3:30 PM</span><br />
<span style="color:#0000ff;">Speaker: Ray Sippel, BJC HealthCare</span></p>
<p>Additionally, you can get hands-on experience with XML on DB2 for Linux, UNIX, and Windows and DB2 for z/OS in the following hands-on labs:</p>
<p><span style="color:#339966;">Lab 1255A </span><br />
<strong><span style="color:#339966;">Beyond SQL With IBM DB2 10: Maintaining and Querying XML Data and RDF Stores</span></strong><br />
<span style="color:#339966;">Thu, Oct 25, 2012, 1:30 PM &#8211; 4:30 PM</span></p>
<p><span style="color:#339966;">Lab 1314A </span><br />
<strong><span style="color:#339966;">New Features in IBM DB2 10 for z/OS Improve Development Productivity (including XML features)</span></strong><br />
<span style="color:#339966;">Mon, Oct 22, 2012, 10:00 AM &#8211; 1:00 PM</span></p>
<p>If you can&#8217;t be in Las Vegas this week (maybe because you&#8217;re on the other side of the globe?), how would <strong>Berlin</strong> work for you?!</p>
<p>The annual European conference of the <a href="http://www.idug.org/p/cm/ld/fid=177">International DB2 User Group (IDUG)</a> is coming up in Berlin, Germany, on November 4 to 9, 2012. For a number of years there hasn&#8217;t been an IDUG conference without any XML sessions, and the same is true this year. Here are some presentations that can you see in Berlin:</p>
<p>&#8220;<strong><span style="color:#0000ff;">An XML Document’s Life &#8211; Dr. Node!</span></strong>&#8220;<br />
<span style="color:#0000ff;">Speaker: Terri Grissom, BMC Software</span><br />
<span style="color:#0000ff;">Wed, Nov 07, 2012, 11:00 AM &#8211; 12:00 PM</span></p>
<p><strong><span style="color:#0000ff;">&#8220;Breaking the Relational Limit with pureXML in DB2 for z/OS&#8221;</span></strong><br />
<span style="color:#0000ff;">Speaker: Mengchu Cai, IBM Silicon Valley Lab</span><br />
<span style="color:#0000ff;">Tue, Nov 06, 2012, 01:00 PM &#8211; 02:00 PM</span></p>
<p><strong><span style="color:#0000ff;">&#8220;How to Design a Hybrid XML/Relational Database Schema</span></strong>&#8220;<br />
<span style="color:#0000ff;">Speaker: Matthias Nicola, IBM Silicon Valley Lab</span><br />
<span style="color:#0000ff;">Tue, Nov 06, 2012, 02:15 PM &#8211; 03:15 PM</span></p>
<p>I hope to see you either in Vegas or in Berlin! Enjoy your conference!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1574/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1574/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1574&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/10/21/xml-from-vegas-to-berlin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Validate XML Documents in Database Queries</title>
		<link>http://nativexmldatabase.com/2012/09/13/how-to-validate-xml-documents-in-database-queries/</link>
		<comments>http://nativexmldatabase.com/2012/09/13/how-to-validate-xml-documents-in-database-queries/#comments</comments>
		<pubDate>Fri, 14 Sep 2012 02:52:16 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1567</guid>
		<description><![CDATA[In DB2, validation of XML documents against XML Schemas is optional. If you choose to validate XML documents in DB2, the most typical scenario is to validate XML documents when they are inserted or loaded into the database. This makes sense: if you ensure that the XML that enters the database is valid, then subsequent [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1567&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In DB2, <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.xml.doc/doc/c0023539.html">validation of XML documents</a> against XML Schemas is optional. If you choose to validate XML documents in DB2, the most typical scenario is to validate XML documents when they are inserted or loaded into the database. This makes sense: if you ensure that the XML that enters the database is valid, then subsequent queries can assume that the data is valid and complies with a particular XML Schema.</p>
<p>Likewise, validation in XML updates statements ensures that document replacement or document modifications do not violate your XML Schema.</p>
<p>Here is a simple example for document validation in INSERT and UPDATE statements, based on an XML Schema that was registered in the <a href="">DB2 XML Schema Repository (XSR)</a> under the SQL name db2admin.myschema:</p>
<p><span style="color:#0000ff;">CREATE TABLE mytable (id INTEGER NOT NULL PRIMARY KEY, doc XML);</span></p>
<p><span style="color:#0000ff;">INSERT INTO mytable<br />
</span><span style="color:#0000ff;">VALUES(?, XMLVALIDATE(? ACCORDING TO XMLSCHEMA ID db2admin.myschema));</span></p>
<p><span style="color:#0000ff;">UPDATE mytable</span><br />
<span style="color:#0000ff;">SET doc = XMLVALIDATE(? ACCORDING TO XMLSCHEMA ID db2admin.myschema)</span><br />
<span style="color:#0000ff;">WHERE id = ?;</span></p>
<p><span style="color:#0000ff;">UPDATE mytable</span><br />
<span style="color:#0000ff;">SET doc = XMLVALIDATE( XMLQUERY(&#8216;copy $new := $DOC</span><br />
<span style="color:#0000ff;">                                 modify do insert &lt;status&gt;delivered&lt;/activated&gt;</span><br />
<span style="color:#0000ff;">                                           into $new/message/header</span><br />
<span style="color:#0000ff;">                                 return $new&#8217;) </span><br />
<span style="color:#0000ff;">             ACCORDING TO XMLSCHEMA ID db2admin.myschema)</span><br />
<span style="color:#0000ff;">WHERE id = ?;</span></p>
<p>There are also cases when you might want to validate XML as part of a query. There can be several reasons for that:</p>
<ul>
<li> Documents were inserted or updated without validation and you need to validate them before consumptions.</li>
<li> You wish to validate XML documents against a different schema than the one was used for validation upon insert or update.</li>
<li> You are extracting fragments of stored XML documents and wish to validate them against a specific schema.</li>
<li> Your queries are constructing entirely new XML documents and you wish to vaidate that the constructed XML complies with a given schema.</li>
</ul>
<p>Regardless of the motivation, XML validation in a query is simple.</p>
<p>You can simply use the <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0022197.html">XMLVALIDATE</a> function in a SELECT statement. All the same options for XMLVALIDATE are allowed as if you would use it in an INSERT or UPDATE statement. Let&#8217;s look at several examples:</p>
<p><span style="color:#0000ff;">SELECT XMLVALIDATE(doc ACCORDING TO XMLSCHEMA ID db2admin.myschema)</span><br />
<span style="color:#0000ff;">FROM mytable</span><br />
<span style="color:#0000ff;">WHERE id = 5;</span></p>
<p>This query above reads a specific document and performs schema validation against the XML Schema that was registered as db2admin.myschema.<br />
If the selected document is valid for the specified schema, the document is returned.<br />
If the selected document is not valid for the specified schema, the query fails and produces an error code that points to why the schema is violated.</p>
<p>Instead of the XML column name <strong>doc</strong>, the XMLVALIDATE function can take any argument of type XML, such the result of an XMLQUERY function. The following query uses the XMLQUERY function to extract just the message body from an XML document and validates it against the XML Schema db2admin.msgbodyXSD:</p>
<p><span style="color:#0000ff;">SELECT XMLVALIDATE( XMLQUERY(&#8216;$DOC/message/body&#8217;)</span><br />
<span style="color:#0000ff;">            ACCORDING TO XMLSCHEMA ID db2admin.msgbodyXSD )</span><br />
<span style="color:#0000ff;">FROM mytable</span><br />
<span style="color:#0000ff;">WHERE id = 5;</span></p>
<p>The next query constructs a new XML document and validates it as part of the query:</p>
<p><span style="color:#0000ff;">SELECT XMLVALIDATE(        </span><br />
<span style="color:#0000ff;">         XMLQUERY(&#8216;document{</span><br />
<span style="color:#0000ff;">                    &lt;newdocument&gt;</span><br />
<span style="color:#0000ff;">                      &lt;header&gt;{$DOC/party/identity}&lt;/header&gt;</span><br />
<span style="color:#0000ff;">                      &lt;body&gt;</span><br />
<span style="color:#0000ff;">                          {$DOC/party/name}</span><br />
<span style="color:#0000ff;">                          {$DOC/party/details/address}</span><br />
<span style="color:#0000ff;">                      &lt;/body&gt;</span><br />
<span style="color:#0000ff;">                   &lt;/newdocument&gt;}&#8217;)</span><br />
<span style="color:#0000ff;">       ACCORDING TO XMLSCHEMA ID db2admin.newdocXSD)</span><br />
<span style="color:#0000ff;">FROM mytable</span><br />
<span style="color:#0000ff;">WHERE id = 5;</span></p>
<p>These examples give you an idea of the capabilities for validating XML query results against an XML Schema.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1567/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1567/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1567&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/09/13/how-to-validate-xml-documents-in-database-queries/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>Result set cardinalities when querying repeating XML elements</title>
		<link>http://nativexmldatabase.com/2012/08/14/result-set-cardinalities-when-querying-repeating-xml-elements/</link>
		<comments>http://nativexmldatabase.com/2012/08/14/result-set-cardinalities-when-querying-repeating-xml-elements/#comments</comments>
		<pubDate>Tue, 14 Aug 2012 21:29:50 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1541</guid>
		<description><![CDATA[Recently I received some questions about the result sets when querying XML, and especially when querying repeating elements that occur more than once per document. As it turns out, the same logical result can be returned in different ways, depending on how you write your XQuery or SQL/XML query. Let&#8217;s look at a simple table [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1541&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Recently I received some questions about the result sets when querying XML, and especially when querying repeating elements that occur more than once per document.</p>
<p>As it turns out, the same logical result can be returned in different ways, depending on how you write your XQuery or SQL/XML query.</p>
<p>Let&#8217;s look at a simple table with two XML documents, and then at several different queries against that data. Here is the sample data:</p>
<pre class="brush: sql; light: true; title: ; notranslate">

create table testtable(doc XML);

insert into testtable(doc)
 values ('&lt;a id=&quot;1&quot;&gt;
             &lt;b&gt;1&lt;/b&gt;
             &lt;b&gt;2&lt;/b&gt;
          &lt;/a&gt;');

insert into testtable(doc)
 values ('&lt;a id=&quot;2&quot;&gt;
             &lt;b&gt;3&lt;/b&gt;
             &lt;b&gt;4&lt;/b&gt;
             &lt;b&gt;5&lt;/b&gt;
         &lt;/a&gt;');
</pre>
<p>Now assume we want to return all the &lt;b&gt; elements from these two documents. You can write such a query in several different ways, each returning the same &lt;b&gt; elements in a slightly different way:</p>
<ol>
<li>XQuery FLWOR expression</li>
<li>XQuery FLWOR expression within an SQL VALUES clause</li>
<li>SQL/XML query with the XMLQUERY function</li>
<li>SQL/XML query with the XMLTABLE function</li>
</ol>
<p>Let&#8217;s look at each of these options in turn.</p>
<h3>1. XQuery FLWOR expression</h3>
<p>The fist example is a simple XQuery FLWOR expression. It iterates over the path /a/b in all documents and returns the &lt;b&gt; elements one by one. The result is a sequence of 5 elements, and each is returned as a single item in the result set:</p>
<pre class="brush: sql; light: true; title: ; notranslate">
xquery
 for $b in db2-fn:xmlcolumn(&quot;TESTTABLE.DOC&quot;)/a/b
 return $b';

&lt;b&gt;1&lt;/b&gt;
&lt;b&gt;2&lt;/b&gt;
&lt;b&gt;3&lt;/b&gt;
&lt;b&gt;4&lt;/b&gt;
&lt;b&gt;5&lt;/b&gt;

5 record(s) selected.
</pre>
<h3>2. XQuery FLWOR expression in an SQL VALUES clause</h3>
<p>If you enclose the same FLWOR expression in an SQL VALUES clause then the same XML elements are returned in a different format.</p>
<p>In this example, the VALUES clause produces a single value. The SQL type of that value is the XML data type and the value itself is a sequence of 5 elements. The entire sequence is returned as a single value of type XML:</p>
<pre class="brush: sql; light: true; title: ; notranslate">
values(xmlquery('
 for $b in db2-fn:xmlcolumn(&quot;TESTTABLE.DOC&quot;)/a/b
 return $b'));

&lt;b&gt;1&lt;/b&gt;&lt;b&gt;2&lt;/b&gt;&lt;b&gt;3&lt;/b&gt;&lt;b&gt;4&lt;/b&gt;&lt;b&gt;5&lt;/b&gt;

1 record(s) selected.
</pre>
<h3>3. SQL/XML query with the XMLQUERY function</h3>
<p>You could also write an SQL SELECT statement and include your XQuery or XPath expression in an XMLQUERY function.</p>
<p>Note that the XMLQUERY function is a <em>scalar</em> function, i.e. it returns one result value of type XML for each row that it is applied to. Since our sample table contains two rows, the following query returns two results values of type XML. The first value is a sequence with all the &lt;b&gt; elements from the first document, and the second value is the sequence of all &lt;b&gt; elements from the second document:</p>
<pre class="brush: sql; light: true; title: ; notranslate">
SELECT xmlquery('for $b in $DOC/a/b return $b') as col1
FROM testtable;

COL1
----------------------------
&lt;b&gt;1&lt;/b&gt;&lt;b&gt;2&lt;/b&gt;
&lt;b&gt;3&lt;/b&gt;&lt;b&gt;4&lt;/b&gt;&lt;b&gt;5&lt;/b&gt;

2 record(s) selected.


-- same result with a simple XPath:
SELECT xmlquery('$DOC/a/b') as col1
FROM testtable;

COL1
----------------------------
&lt;b&gt;1&lt;/b&gt;&lt;b&gt;2&lt;/b&gt;
&lt;b&gt;3&lt;/b&gt;&lt;b&gt;4&lt;/b&gt;&lt;b&gt;5&lt;/b&gt;

2 record(s) selected.
</pre>
<p>The potential benefit of this result format is that you now exactly which &lt;b&gt; elements came from the same input document. If you prefer to return each &lt;b&gt; element as a separate item, use the XMLTABLE function.</p>
<h3>4. SQL/XML query with the XMLTABLE function</h3>
<p>The XMLTABLE function is not a scalar function, it&#8217;s a table function. This means that it returns a set of result rows for each input document. More precisely, it return one result row for each item that is produced buy the row-generating expression /a/b:</p>
<pre class="brush: sql; light: true; title: ; notranslate">
-- return a column of type XML:
SELECT X.*
FROM testtable,
 XMLTABLE('$DOC/a/b'
 COLUMNS
 col1 XML PATH '.') as X;

COL1
----------------------------
&lt;b&gt;1&lt;/b&gt;
&lt;b&gt;2&lt;/b&gt;
&lt;b&gt;3&lt;/b&gt;
&lt;b&gt;4&lt;/b&gt;
&lt;b&gt;5&lt;/b&gt;

5 record(s) selected.

-- return a column of type integer:
SELECT X.*
FROM testtable,
 XMLTABLE('$DOC/a/b'
 COLUMNS
 col1 INTEGER PATH '.') as X;

COL1
--------
 1
 2
 3
 4
 5

5 record(s) selected.

</pre>
<p>The result sets in all of these example make sense and are consistent with SQL semantics. You can chose the shape of your query results and write your queries accordingly.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1541/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1541&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/08/14/result-set-cardinalities-when-querying-repeating-xml-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the XMLTABLE function with MERGE statements in DB2 for z/OS</title>
		<link>http://nativexmldatabase.com/2012/08/10/using-the-xmltable-function-with-merge-statements-in-db2-for-zos/</link>
		<comments>http://nativexmldatabase.com/2012/08/10/using-the-xmltable-function-with-merge-statements-in-db2-for-zos/#comments</comments>
		<pubDate>Sat, 11 Aug 2012 00:42:48 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1534</guid>
		<description><![CDATA[This is an add-on to my previous post on Using the XMLTABLE function in UPDATE and MERGE statements. I had tested all the examples in that previous post in DB2 for Linux, UNIX, and Windows but overlooked that DB2 for z/OS currently has a restriction for the MERGE statement. The MERGE statement in DB2 for z/OS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1534&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is an add-on to my previous post on <a title="Permalink to Using the XMLTABLE function in UPDATE and MERGE statements" href="http://nativexmldatabase.com/2012/07/30/using-the-xmltable-function-in-update-and-merge-statements/" rel="bookmark">Using the XMLTABLE function in UPDATE and MERGE statements</a>.</p>
<p>I had tested all the examples in that previous post in DB2 for Linux, UNIX, and Windows but overlooked that DB2 for z/OS currently has a restriction for the MERGE statement.</p>
<p>The MERGE statement in DB2 for z/OS expects a VALUES clause to provide the data that is to be merged, not an arbitrary sub-select. For details, see:<br />
<a href="http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db2z9.doc.sqlref/src/tpc/db2z_sql_merge.htm">http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db2z9.doc.sqlref/src/tpc/db2z_sql_merge.htm</a></p>
<p>As a result, the MERGE example at the end of my previous post needs to be adjusted for DB2 z/OS. For example, you can use an SQL procedure to loop over the rows produced by the XMLTABLE query and feed these rows into the MERGE statement:</p>
<pre class="brush: sql; title: ; notranslate">

CREATE PROCEDURE XMLMERGE(IN P_CHANGE XML)
LANGUAGE SQL
BEGIN
  DECLARE ID INT;
  DECLARE X INTEGER;
  DECLARE Y VARCHAR(20);
  DECLARE SQLCODE INT;

  DECLARE C1 CURSOR FOR
    SELECT ID, X, Y
    FROM XMLTABLE('$DOC/root/mydata' PASSING P_CHANGE AS &quot;DOC&quot;
         COLUMNS
           id INTEGER     PATH '@id',
           x  INTEGER     PATH 'elem1',
           y  VARCHAR(20) PATH 'elem2') T;

  OPEN C1;
    LOOP1: LOOP
      FETCH C1 INTO ID, X, Y;
      IF SQLCODE &lt;&gt; 0 THEN LEAVE LOOP1; END IF;

      MERGE INTO RELTABLE   R
      USING (VALUES(ID, X, Y)) AS N(ID, X, Y)
      ON (R.ID = N.ID)
      WHEN MATCHED THEN UPDATE SET R.X = X, R.Y = Y
      WHEN NOT MATCHED THEN INSERT VALUES(ID, X, Y);
    END LOOP LOOP1;
  CLOSE C1;
END

</pre>
<p>Thanks to my colleague Guogen Zhang for providing this sample solution.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1534/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1534/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1534&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/08/10/using-the-xmltable-function-with-merge-statements-in-db2-for-zos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the XMLTABLE function in UPDATE and MERGE statements</title>
		<link>http://nativexmldatabase.com/2012/07/30/using-the-xmltable-function-in-update-and-merge-statements/</link>
		<comments>http://nativexmldatabase.com/2012/07/30/using-the-xmltable-function-in-update-and-merge-statements/#comments</comments>
		<pubDate>Tue, 31 Jul 2012 05:32:28 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1491</guid>
		<description><![CDATA[The XMLTABLE function is part of the SQL standard. It can take XML as input, use XPath or XQuery expressions to extract values or pieces from the XML, and return the result in a relational row and column format. As discussed in a previous blog post, the XMLTABLE function is often used in queries to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1491&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The XMLTABLE function is part of the SQL standard. It can take XML as input, use XPath or XQuery expressions to extract values or pieces from the XML, and return the result in a relational row and column format.</p>
<p>As discussed in a <a href="http://nativexmldatabase.com/2010/04/12/the-xmltable-function-and-a-case-where-a-left-outer-join-can-help/">previous blog post</a>, the XMLTABLE function is often used in queries to read XML documents from an XML column in the database and return the extracted values as a relational result set.</p>
<p>But, the XMLTABLE function can also be used in INSERT and UPDATE statements. This allows an application to pass an XML document as a parameter to an INSERT or UPDATE statement that extractx selected values and uses them to insert or update relational rows in a table.</p>
<p>Using the XMLTABLE function in INSERT statements is quite common if requirements dictate that XML needs to be shredded to relational tables rather than stored natively in an XML column.</p>
<p>Here is a simple example that extracts values from a small XML document and inserts these values into the table &#8220;reltable&#8221;:</p>
<pre class="brush: sql; title: ; notranslate">

CREATE TABLE reltable(id int, col2 int, col3 varchar(20));

INSERT INTO reltable
SELECT id, x, y
FROM XMLTABLE ('$doc/mydata'
       PASSING xmlparse(document '&lt;mydata id=&quot;1&quot;&gt;
                                     &lt;elem1&gt;555&lt;/elem1&gt;
                                     &lt;elem2&gt;test&lt;/elem2&gt;
                                  &lt;/mydata&gt;') as &quot;doc&quot;
       COLUMNS
          id INTEGER     PATH '@id',
          x  INTEGER     PATH 'elem1',
          y  VARCHAR(20) PATH 'elem2'   );

SELECT * FROM reltable;

ID          COL2        COL3
----------- ----------- --------------------
          1         555 test

1 record(s) selected.
</pre>
<p>The PASSING clause assigns the input document to the variable &#8220;$doc&#8221; which is then the starting point for the extraction.</p>
<p>You don&#8217;t necessarily need to hardcode the XML input document in the INSERT statement. It can also be supplied via a parameter marker or host variable, as in this example:</p>
<pre class="brush: sql; title: ; notranslate">
INSERT INTO reltable
SELECT id, x, y
FROM XMLTABLE ('$doc/mydata'  PASSING  cast(? as XML) as &quot;doc&quot;
       COLUMNS
          id INTEGER     PATH '@id',
          x  INTEGER     PATH 'elem1',
          y  VARCHAR(20) PATH 'elem2'   );
</pre>
<p>Ok, this was the easy part.</p>
<p>Now what if we want to use the XMLTABLE function in an UPDATE statement to replace the values in an existing row in &#8220;reltable&#8221; with new values from an incoming XML document? It might not be quite as obvious how to write such an UPDATE statement, but as it turns out it&#8217;s not very hard either!</p>
<p>Here is an UPDATE statement that extracts the values of the XML elements &#8220;elem1&#8243; and &#8220;elem2&#8243; to update the columns &#8220;col2&#8243; and &#8220;col3&#8243; in &#8220;reltable&#8221; for the row that has id = 1.</p>
<pre class="brush: sql; title: ; notranslate">
UPDATE reltable
SET (col2, col3) = (SELECT x, y
                    FROM XMLTABLE ('$doc/mydata' PASSING
                           xmlparse(document '&lt;mydata id=&quot;1&quot;&gt;
                                                 &lt;elem1&gt;777&lt;/elem1&gt;
                                                 &lt;elem2&gt;abcd&lt;/elem2&gt;
                                              &lt;/mydata&gt;') as &quot;doc&quot;
                         COLUMNS
                           x  INTEGER     PATH 'elem1',
                           y  VARCHAR(20) PATH 'elem2'   )
                    )
WHERE id = 1;

SELECT * FROM reltable;

ID          COL2        COL3
----------- ----------- --------------------
          1         777 abcd

1 record(s) selected.
</pre>
<p>The UPDATE statement above uses a simple WHERE clause to select a specific row to be updated. But, what if we don&#8217;t know which target row the incoming XML document needs to be applied to? Ideally, we want to extract the @id attribute from the input document and update whichever row matches its value.</p>
<p>We might be tempted to simply extract the @id attribute in the same XMLTABLE function and add a join predicate to the subselect, like this:</p>
<pre class="brush: sql; title: ; notranslate">
-- this statement is not a good idea!
UPDATE reltable r
SET (r.col2, r.col3) = (SELECT T.x, T.y
                        FROM XMLTABLE ('$doc/mydata'
                              PASSING  cast(? as XML) as &quot;doc&quot;
                              COLUMNS
                                id INTEGER     PATH '@id',
                                x  INTEGER     PATH 'elem1',
                                y  VARCHAR(20) PATH 'elem2' ) T
                        WHERE r.id = T.id
                       );
</pre>
<p>But, this statement would update <em>all </em>rows in the table (many of them with NULL values) because the WHERE clause only applies to the rows produced by the subselect, not to the rows in &#8220;reltable&#8221;.</p>
<p>One possible solution is to add a WHERE clause that extracts the @id attribute as needed to filter the rows in &#8220;reltable&#8221;:</p>
<pre class="brush: sql; title: ; notranslate">
-- this statement is better, but not optimal
UPDATE reltable
SET (col2, col3) = (SELECT x, y
                    FROM XMLTABLE ('$doc/mydata'
                          PASSING  cast(? as XML) as &quot;doc&quot;
                          COLUMNS
                            x  INTEGER     PATH 'elem1',
                            y  VARCHAR(20) PATH 'elem2' )
                    )
WHERE id = XMLCAST( XMLQUERY('$doc/mydata/@id'
                    PASSING cast(? as XML) as &quot;doc&quot;) AS INTEGER);
</pre>
<p>Yes, this works, but it requires us to pass the XML document into the statement twice: once into the subselect in the SET clause, and once into the XMLQUERY function in the WHERE clause. That&#8217;s not very elegant and probably  not ideal for performance either.</p>
<p>There might be multiple ways to improve the UPDATE statement above. One nice solution is to use a MERGE statement:</p>
<pre class="brush: sql; title: ; notranslate">

MERGE INTO reltable r
USING (SELECT id, x, y
       FROM XMLTABLE ('$doc/mydata' PASSING  cast(? as XML) as &quot;doc&quot;
             COLUMNS
               id INTEGER     PATH '@id',
               x  INTEGER     PATH 'elem1',
               y  VARCHAR(20) PATH 'elem2'   )) t
ON r.id = t.id
WHEN MATCHED
THEN UPDATE SET r.col2 = t.x, r.col3 = t.y;
</pre>
<p>The nice thing about the MERGE statement is that it can also handle multiple cases where the XMLTABLE function produces multiple rows whose keys may or may not already exist in the target table, so that UPDATE and/or INSERT operations need to be performed. Here is an example:</p>
<pre class="brush: sql; title: ; notranslate">

MERGE INTO reltable r
USING (SELECT id, x, y
       FROM XMLTABLE ('$doc/root/mydata'
             PASSING xmlparse(document '&lt;root&gt;
                                         &lt;mydata id=&quot;1&quot;&gt;
                                          &lt;elem1&gt;999&lt;/elem1&gt;
                                          &lt;elem2&gt;xyz&lt;/elem2&gt;
                                         &lt;/mydata&gt;
                                         &lt;mydata id=&quot;3&quot;&gt;
                                          &lt;elem1&gt;333&lt;/elem1&gt;
                                          &lt;elem2&gt;test33&lt;/elem2&gt;
                                         &lt;/mydata&gt;
                                        &lt;/root&gt;') as &quot;doc&quot;
             COLUMNS
               id INTEGER     PATH '@id',
               x  INTEGER     PATH 'elem1',
               y  VARCHAR(20) PATH 'elem2'   )) t
ON r.id = t.id
WHEN MATCHED     THEN UPDATE SET r.col2 = t.x, r.col3 = t.y
WHEN NOT MATCHED THEN INSERT VALUES(t.id, t.x, t.y);

SELECT * FROM reltable;

ID          COL2        COL3
----------- ----------- --------------------
          1         999 xyz
          3         333 test33

2 record(s) selected.

</pre>
<p>This blog post has provided some basic examples that might serve as a starting point to develop your own INSERT, UPDATE, and MERGE statements with the <a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0709nicola/">XMLTABLE</a> function.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1491/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1491/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1491&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/07/30/using-the-xmltable-function-in-update-and-merge-statements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>
	</item>
		<item>
		<title>XML Storage in DB2: To inline or not to inline?</title>
		<link>http://nativexmldatabase.com/2012/07/11/xml-storage-in-db2-to-inline-or-not-to-inline/</link>
		<comments>http://nativexmldatabase.com/2012/07/11/xml-storage-in-db2-to-inline-or-not-to-inline/#comments</comments>
		<pubDate>Wed, 11 Jul 2012 09:27:01 +0000</pubDate>
		<dc:creator>Matthias Nicola</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nativexmldatabase.com/?p=1482</guid>
		<description><![CDATA[First, let&#8217;s revisit the concept of inlined XML storage and then discuss the pros and cons of inlining. What is XML Inlining? In short, inlining is an optional storage optimization in DB2 for &#8220;small&#8221; XML documents. When you define a table with an XML column in DB2, such as CREATE TABLE mytable(id INTEGER, &#8230;.. , [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1482&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>First, let&#8217;s revisit the concept of inlined XML storage and then discuss the pros and cons of inlining.</p>
<p><strong>What is XML Inlining?</strong></p>
<p>In short, inlining is an optional storage optimization in DB2 for &#8220;small&#8221; XML documents.</p>
<p>When you define a table with an XML column in DB2, such as <span style="color:#0000ff;">CREATE TABLE mytable(id INTEGER, &#8230;.. , doc XML)</span>, the DB2 server creates three storage objects in the table space:</p>
<ul>
<li>A data object (DAT), which holds the relational rows of the table</li>
<li>An index object (INX), which stores any indexes for the table</li>
<li>An XML storage object (XDA), which is the XML Storage Area and holds any XML documents</li>
</ul>
<p>Optionally, you can assign these three objects to different table spaces but by default they all go into the same table space.</p>
<p>As illustrated in the following picture, the XML column in the data object doesn&#8217;t contain the actual XML document, but only references (descriptors) of where the documents can be found. The XML document trees are stored in the XDA object, and if a tree is larger than a single page then it is automatically cut into multiple regions. This way, large documents can span many pages, and that&#8217;s completely transparent to your application.</p>
<p>The region index -automatically defined and maintained by DB2- essentially remembers which regions belong to the same XML document for any given row in the data object. The regions index also enables very efficient access to any portion of an XML document. If only some part of a large document is required, e.g. to answer a query, DB2 does not necessarily need to bring <em>all</em> pages of the document into the buffer pool.</p>
<p><a href="http://purexml.files.wordpress.com/2012/07/xmlstorage_noinlining1.jpg"><img class="aligncenter size-full wp-image-1486" title="XMLStorage_NoInlining" src="http://purexml.files.wordpress.com/2012/07/xmlstorage_noinlining1.jpg?w=480&#038;h=373" alt="" width="480" height="373" /></a></p>
<p>The XML documents that are small enough to fit onto a single page just have a single region, and multiple regions can be stored on the same page, if space is available.</p>
<p>As it turns out, there are very many applications that deal with small XML documents, often just 1KB to 20KB for most documents. The access to such small documents can be optimized by storing there document trees right in the DAT object, together with the rows that they belong to. This is called <em>inlined XML storage</em> and is illustrated in the following picture.</p>
<p>To enable inlining, define the XML column with an INLINE LENGTH that indicates that maximum size up to which you want documents to be inlined. For example:</p>
<p><span style="color:#0000ff;">CREATE TABLE mytable(id INTEGER, &#8230;.. , doc XML INLINE LENGTH 30000)</span></p>
<p>In this example, any XML documents whose parsed hierarchical representation is less than 30000 bytes will be inlined. Any documents that are larger than this are automatically stored in the XDA object as usual. The application sees no difference.</p>
<p>The specified INLINE LENGTH must be smaller than the page size of the DB2 table space minus the length of any other columns in the table.</p>
<p><a href="http://purexml.files.wordpress.com/2012/07/xmlstorage_inlining1.jpg"><img class="aligncenter size-full wp-image-1485" title="XMLStorage_Inlining" src="http://purexml.files.wordpress.com/2012/07/xmlstorage_inlining1.jpg?w=480&#038;h=367" alt="" width="480" height="367" /></a></p>
<p>Inlined documents are stored in the same tree format as documents that are not inlined. Just in a different location.</p>
<p><strong>The Pros and Cons of Inlining</strong></p>
<p>Performance measurements and plenty of experience with real XML applications have shown that <em>inlining is almost always recommended</em>, if a large percentage of your XML documents (for example, more than  70%) can be inlined. The benefits of inlining include the following:</p>
<ul>
<li>Faster access to inlined documents &#8211; no redirection via the regions index</li>
<li>The regions index has no entries for inlined documents. If a large percentage of your documents are inlined then this reduces the space and maintenance cost associated with the regions index.</li>
<li>Better prefetching since inlined XML documents are prefetched as part of the row they belong to.</li>
</ul>
<p>A key characteristic of inlining is that it drastically increases the row size on the data pages, and hence reduces the number of rows per data page. This can negatively impact the performance of queries that read <em>only</em> relational columns and do <em>not</em> access the XML column. For example, consider the following table and query:</p>
<p><span style="color:#0000ff;">CREATE TABLE myxml(c1 INT, c2 INT, c3 INT, doc XML INLINE LENGTH 30000);</span></p>
<p><span style="color:#0000ff;">SELECT SUM(c1 + c2 + c3)<br />
FROM myxml;</span></p>
<p>This query reads the 3 integer columns from *all* rows in the table. Due to the inlined XML column, these rows are spread over a much larger number of pages than without inlining, so this query needs to fetch a lot more pages than without inlining. If you have many such queries, then inlining might not be the best choice for you.</p>
<p><strong>How do I know whether a given document is inlined?</strong></p>
<p>The DB2 function <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0054082.html">ADMIN_IS_INLINED</a> can be applied to an XML column and it returns 1 if a document is inlined, and zero otherwise. This enables you to determine which and how many documents are inlined.</p>
<p>The DB2 function <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0054083.html">ADMIN_EST_INLINE_LENGTH </a>can also be applied to an XML document in an XML column and returns the smallest required inline length for this document to be inlined, or -1 if the document is too large to be inlined.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/purexml.wordpress.com/1482/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/purexml.wordpress.com/1482/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nativexmldatabase.com&#038;blog=3215007&#038;post=1482&#038;subd=purexml&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nativexmldatabase.com/2012/07/11/xml-storage-in-db2-to-inline-or-not-to-inline/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0fa2a8696cf3869ab2ded9243422d875?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Matthias</media:title>
		</media:content>

		<media:content url="http://purexml.files.wordpress.com/2012/07/xmlstorage_noinlining1.jpg" medium="image">
			<media:title type="html">XMLStorage_NoInlining</media:title>
		</media:content>

		<media:content url="http://purexml.files.wordpress.com/2012/07/xmlstorage_inlining1.jpg" medium="image">
			<media:title type="html">XMLStorage_Inlining</media:title>
		</media:content>
	</item>
	</channel>
</rss>
