db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r990002 - /db/derby/docs/trunk/src/devguide/cdevstandardsxml.dita
Date Fri, 27 Aug 2010 02:58:31 GMT
Author: bpendleton
Date: Fri Aug 27 02:58:31 2010
New Revision: 990002

URL: http://svn.apache.org/viewvc?rev=990002&view=rev
Log:
DERBY-4623: Improve documentation of XML data types

This patch was contributed by C.S. Nirmal J. Fernando (nirmal070125 at gmail dot com)

This patch adds some additional examples and explanation to the XML Data types
and operators page.

Modified:
    db/derby/docs/trunk/src/devguide/cdevstandardsxml.dita

Modified: db/derby/docs/trunk/src/devguide/cdevstandardsxml.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/devguide/cdevstandardsxml.dita?rev=990002&r1=990001&r2=990002&view=diff
==============================================================================
--- db/derby/docs/trunk/src/devguide/cdevstandardsxml.dita (original)
+++ db/derby/docs/trunk/src/devguide/cdevstandardsxml.dita Fri Aug 27 02:58:31 2010
@@ -36,17 +36,40 @@ data types<indexterm>limitations</indext
 bind directly into an XML value or to retrieve an XML value directly from
 a result set.  Instead, you must bind and retrieve the XML data as Java strings
 or character streams by explicitly specifying the appropriate XML operator
-as part of the SQL statements:<ul>
-<li>Use the XMLPARSE operator for binding data into XML values.</li>
-<li>Use the XMLSERIALIZE operator to retrieve XML values from a result set.</li>
-</ul> Additionally, there is no JDBC metadata support for the XML data type.</p>
+as part of the SQL statements:</p>
+<ul>
+<li>Create a table with a XML data typed column. For example:
+     <codeblock>CREATE TABLE xml_data(xml_col XML);</codeblock>
+</li>
+<li>Use the XMLPARSE operator for binding data into XML values. For example:
+<codeblock>INSERT INTO xml_data(xml_col) 
+  VALUES(XMLPARSE(DOCUMENT ' &lt;name&gt; Derby &lt;/name&gt;' PRESERVE WHITESPACE));</codeblock>
+<note>You must insert the XML keywords DOCUMENT and PRESERVE WHITESPACE.
+Actual XML data should be inside single quotation marks, and
+values should be within the starting XML tag and the ending XML tag.</note>       
         
+</li>
+<li>Use the XMLSERIALIZE operator to retrieve XML values from a result set.
+For example:
+<codeblock>SELECT XMLSERIALIZE(xml_col AS CLOB) FROM xml_data;</codeblock> 
+<note>You can also specify <codeph>xml_col AS VARCHAR(25)</codeph>.</note>
   
+</li>
+<li>Use non-XML data retrieved from a non-XML column to create an XML fragment.
+For example: <codeblock>     SELECT '&lt;my_self&gt;' ||     
+     '&lt;name&gt;'|| my_name ||'&lt;/name&gt;' ||                 
+     '&lt;age&gt;'|| TRIM(CHAR(my_age)) ||'&lt;/age&gt;'||              
  
+     '&lt;/my_self&gt;'                       
+     FROM my_non_xml_table;</codeblock>
+<note>This will result in XML fragments, which you must plug
+into an XML document.</note>
+</li></ul>
+<p>Additionally, there is no JDBC metadata support for the XML data type.</p>
 <p>The XML data type is not allowed in any of the clauses or operations that
 are described in the section on expressions on LONG data types in 
 <xref href="cdevstandards806118.dita#cdevstandards806118"></xref>.</p>
 <p>For the XML operators to work properly, <ph conref="../conrefs.dita#prod/productshortname"></ph>
requires
 that a JAXP parser, such as Apache Xerces, and Apache Xalan are included in
-the Java classpath. If either the parser or Xalan are missing from the classpath, <ph
-conref="../conrefs.dita#prod/productshortname"></ph> disallows any XML-related
+the Java classpath. If either the parser or Xalan are missing from the classpath, 
+<ph conref="../conrefs.dita#prod/productshortname"></ph> disallows any XML-related
 operations.  </p>
 <section><title>Classpath and version issues</title>
 <p>Most Java Virtual Machines (JVMs) that are version 1.4 or later have



Mime
View raw message