Web Service Example 7: XML Schema Definition for Tours

Previous Next

See Also

This topic is part of Web Service Example 7: Component Table with an Output XSL Transformation. In this example, you need an XML schema definition for Tours. First, here is an example of the Tours XML output for which we need an XML schema:

<Tours documentName="Tours">

<TOUR DESTINATION="AUSTRALIA" TOUR_TYPE="ISLAND SUNTANNER" NUM_DAYS="13" MAX_AGE="65" DESCRIPTION="Exclusive sailing adventure,to the Great Barrier Reef"/>

<TOUR DESTINATION="AUSTRALIA" TOUR_TYPE="ROCKS" NUM_DAYS="12" MAX_AGE="65" DESCRIPTION="Ayers Rock climb"/>

</Tours>

The XML schema definition for this XML output is:

<?xml version="1.0"?>

<xsd:schema targetNamespace="urn:Tour" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:Tour" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<xsd:complexType name="Tours">

<xsd:sequence>

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

<xsd:complexType>

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

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

<xsd:attribute name="NUM_DAYS" type="xsd:int" use="required"></xsd:attribute>

<xsd:attribute name="MAX_AGE" type="xsd:int"></xsd:attribute>

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

</xsd:complexType>

</xsd:element>

</xsd:sequence>

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

</xsd:complexType>

</xsd:schema>