Purpose
Retrieves the XML content that is stored as an XMLVARCHAR type and stores it in an external server file.
Syntax
XMLVARCHAR to external server file |
---|
>>-Content--(--xmlobj--,--filename--)-------------------------->< |
Important: If a file with the specified name already exists, the content function overrides its content.
Note: |
Parameters
Table 27. XMLVarchar to external server file parameters
Parameter | Data type | Description |
---|---|---|
xmlobj | XMLVARCHAR | The XML document. |
filename | VARCHAR(512) | The fully qualified server file name. |
Return type
VARCHAR(512)
Example
The following example retrieves the XML content that is stored as XMLVARCHAR type and stores it in an external server file.
CREATE table app1 (id int NOT NULL, order db2xml.XMLVarchar); INSERT into app1 values (1, '<?xml version="1.0"?> <!DOCTYPE SYSTEM c:\dxx\samples\dtd\getstart.dtd"-> <Order key="1"> <Customer> <Name>American Motors</Name> <Email>parts@am.com</Email> </Customer> <Part color="black"> <key>68</key> <Quantity>36</Quantity> <ExtendedPrice>34850.16</ExtendedPrice> <Tax>6.000000e-02</Tax> <Shipment> <ShipDate>1998-08-19</ShipDate> <ShipMode>AIR </ShipMode> </Shipment> <Shipment> <ShipDate>1998-08-19</ShipDate> <ShipMode>BOAT </ShipMode> </Shipment> </Order>'); SELECT db2xml.Content(order, 'c:\dxx\samples\cmd\getstart_.dad') from app1 where ID=1;