Web Service Example 5: XML Schema Definition for Scheduled Tours

Previous Next

This topic is part of Web Service Example 5: Document-Oriented Method with Complex Type Parameters. In this example, you need an XML schema definition for Scheduled Tours. First, here is an example of the Tours XML output for which we need an XML schema:

<Scheduled_Tours documentName="Scheduled Tours">

   <SCHEDTOUR TOUR_TYPE="ISLAND SUNTANNER" START_DATE="2005-11-01000000" RETURN_DATE="2005-11-13000000" PRICE="120" MAX_PART="10" GUIDE="137"/>

   <SCHEDTOUR TOUR_TYPE="ISLAND SUNTANNER" START_DATE="2005-11-15000000" RETURN_DATE="2005-11-27000000" PRICE="122" MAX_PART="5" GUIDE="6"/>

   <SCHEDTOUR TOUR_TYPE="ISLAND SUNTANNER" START_DATE="2005-11-29000000" RETURN_DATE="2005-12-11000000" PRICE="118" MAX_PART="5" GUIDE="6"/>

</Scheduled_Tours>

 

The XML schema definition for this XML output is:

<?xml version="1.0"?>

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

<xsd:complexType name="Scheduled_Tours">

<xsd:sequence>

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

   <xsd:complexType>

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

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

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

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

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

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

   </xsd:complexType>

   </xsd:element>

</xsd:sequence>

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

   </xsd:complexType>

</xsd:schema>