Returning an Entire XML Column

Using DataDirect XQuery®, it's straightforward to return an entire XML column because it does not require evaluation of the contents of the column. For the HOLDINGSXML table, the following query returns a column:

collection('HOLDINGSXML')/HOLDINGSXML/XMLCOL

The result looks like this:

<XMLCOL>
	<HOLDINGS>
	   <SHARE COMPANY="Amazon.com, Inc." 
              USERID="Jonathan">3000</SHARE>
	   <SHARE COMPANY="eBay Inc." USERID="Jonathan">4000</SHARE>
	   <SHARE COMPANY="Int'l Business Machines C" 
              USERID="Jonathan">2500</SHARE>
	   <SHARE COMPANY="Progress Software"
              USERID="Jonathan">23</SHARE>
	</HOLDINGS>
</XMLCOL>
<XMLCOL>
	<HOLDINGS>
	   <SHARE COMPANY="Amazon.com, Inc." 
              USERID="Minollo">3000</SHARE>
	   <SHARE COMPANY="eBay Inc." USERID="Minollo">4000</SHARE>
	   <SHARE COMPANY="Lucent Technologies Inc." 
              USERID="Minollo">40000</SHARE>
	   <SHARE COMPANY="Progress Software" 
              USERID="Minollo">4000000</SHARE>
	</HOLDINGS>
</XMLCOL>

In contrast, any query that evaluates path expressions against the contents of an XML column fails. For example, the following query fails and raises an error:

collection('HOLDINGSXML')/HOLDINGSXML/XMLCOL/HOLDINGS

Because the // operator requires all descendant nodes to be evaluated, this operation fails if applied to an XML column. For example, the following query fails and raises an error:

collection('HOLDINGSXML')//HOLDINGSXML

Try DataDirect XQuery® Free!

Put the power, scalability, and performance of DataDirect XQuery® to work for you today! Our free trial lets you see for yourself how easy it is to build data integration applications that access relational, EDI, and other file formats as XML!

Download DataDirect XQuery® today!

Online Video Tutorials!

Our easy-to-follow online video tutorials are a great way to get acquainted with the many features of DataDirect XQuery®.

And if you like what you see, download a free copy today and try DataDirect XQuery® for yourself!

Stay Informed!

XQuery is one of the hottest XML technologies being developed today. Stay informed with vital news about standards, tools, and trends by signing up for the DataDirect XQuery® newsletter.