IBM Books

XML Extender Administration and Programming

Composing the XML document

In this step, you use the dxxGenXML() stored procedure to compose the XML document specified by the DAD file. This stored procedure returns the document as an XMLVARCHAR UDT.

To compose the XML document:

  1. From the DB2 Command Window, enter the following command to run the stored procedure:
    getstart_stp.cmd
    

    The XML document has been composed and is stored in the RESULT_TAB table.

    You can see samples of stored procedures that can be used in this step in the following files:

  2. Export the XML document from the table to a file using the XML Extender retrieval function, Content():
    DB2 CONNECT TO SALES_DB
     
    DB2 SELECT db2xml.Content(db2xml.xmlvarchar(doc), 
       'c:\dxx\samples\cmd\getstart.xml') FROM RESULT_TAB
    

    Alternatively, you can run the following command to export the file:

    getstart_exportXML.cmd
    

    This lesson teaches you how to get one or more composed XML documents using DB2 stored procedure's result set feature to allow you to fetch each row to get each document. As you get each row of document, you can export it to a file, which is the simplest way to demonstrate this feature. For more efficient ways of fetching data see the CLI examples in c:\dxx\samples\cli.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]