The XML GenerateComplexType Method

Previous Next

See Also

The GenerateComplexType method generates an XML complex type for an XML document returned by the XML export method.

SYNTAX

INVOKE XML.GenerateComplexType

WITH

SELECT    <expression>[,expression]

[FROM]    <table name>

EXAMPLE

INVOKE     xml.GenerateComplexType

WITH

SELECT     destination, description

FROM     tour

This results in the following output:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:USoft:Tours" xmlns:tns="urn:USoft:Tours">

<xsd:complexType name="ToursEx">

   <xsd:sequence>

   <xsd:element name="Tours" type="tns:Tours"></xsd:element>

   </xsd:sequence>

</xsd:complexType>

<xsd:complexType name="Tours">

   <xsd:sequence>

   <xsd:element minOccurs="0" maxOccurs="unbounded" name="TOUR" type="tns:TOUR"></xsd:element>

   </xsd:sequence>

   <xsd:attribute name="documentName" type="xsd:string"></xsd:attribute>

</xsd:complexType>

<xsd:complexType name="TOUR">

   <xsd:attribute name="DESTINATION" type="xsd:string" use="required"></xsd:attribute>

   <xsd:attribute name="DESCRIPTION" type="xsd:string"></xsd:attribute>

</xsd:complexType>

</xsd:schema>

The Tours complex type can be used as XML Data Type for the output parameter of a document oriented web service that uses SQL statement:

INVOKE     XML.Export

WITH     SELECT destination, description

FROM     TOUR

WHERE     ...