<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:yahoo:prods" xmlns="urn:yahoo:prods" elementFormDefault="qualified">
  <xs:element name="ProductSearch">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Categories" type="CategoryType" minOccurs="0"/>
        <xs:element name="Refinements" type="RefinementsType" minOccurs="0"/>
        <xs:element name="Products" type="ProductsType"/>
      </xs:sequence>
      <xs:attribute name="spellSuggestion" type="xs:string" use="optional"/>	
    </xs:complexType>
  </xs:element>

  <xs:complexType name="CategoryType">
    <xs:sequence>
      <xs:element name="SubCategory" type="LHSNestedType" minOccurs="0" maxOccurs="200"/>
    </xs:sequence>
    <xs:attribute name="totalSubcategories" type="xs:nonNegativeInteger" use="required"/>
    <xs:attribute name="type" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="LHSNestedType">
    <xs:sequence>
      <xs:element name="Title" type="xs:string" minOccurs="1" maxOccurs="1"/>
      <xs:element name="Value" type="xs:string" minOccurs="1" maxOccurs="1"/>
      <xs:element name="NumberOfProducts" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
      <xs:element name="SubCategory" type="LHSNestedType" minOccurs="0" maxOccurs="200"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="RefinementsType">
    <xs:sequence>
      <xs:element name="Refinement" type="RefinementType" minOccurs="0" maxOccurs="100"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="RefinementType">
    <xs:sequence>
      <xs:element name="RefineValue" type="LHSType" minOccurs="1" maxOccurs="2000" />
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required"/>
    <xs:attribute name="totalAvailable" type="xs:nonNegativeInteger"/>
    <xs:attribute name="totalValues" type="xs:nonNegativeInteger" use="required"/>
  </xs:complexType>

  <xs:complexType name="LHSType">
    <xs:sequence>
      <xs:element name="Title" type="xs:string" minOccurs="1" maxOccurs="1"/>
      <xs:element name="Value" type="xs:string" minOccurs="1" maxOccurs="1"/>
      <xs:element name="Category" type="xs:string" minOccurs="0" maxOccurs="1"/>
      <xs:element name="NumberOfProducts" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>


  <xs:complexType name="ProductsType">
    <xs:sequence>
      <xs:element name="Product" type="ProductType" minOccurs="0" maxOccurs="300" />	
    </xs:sequence>
    <xs:attribute name="totalResultsAvailable" type="xs:nonNegativeInteger" use="optional"/>	
    <xs:attribute name="firstResultPosition" type="xs:nonNegativeInteger" use="optional"/>
    <xs:attribute name="totalResultsReturned" type="xs:nonNegativeInteger" use="optional"/>
    <xs:attribute name="relatedSearches" type="xs:string" use="optional"/>	
  </xs:complexType>

  <xs:complexType name="ProductType">
    <xs:choice> 
      <xs:element name="Catalog" type="CatalogType" />
      <xs:element name="Offer" type="OfferType" />	
    </xs:choice>
    <xs:attribute name="type" type="xs:string" use="required"/>		 
  </xs:complexType>

  <xs:complexType name="CatalogType">
    <xs:sequence>
      <xs:element name="Url" type="xs:string"/>
      <xs:element name="ProductName" type="xs:string"/>
      <xs:element name="PriceFrom" type="PriceType"/>
      <xs:element name="PriceTo" type="PriceType" minOccurs="0"/>
      <xs:element name="Thumbnail" type="ImageType" minOccurs="0"/>
      <xs:element name="ListImage" type="ImageType" minOccurs="0"/>
      <xs:element name="GridImage" type="ImageType" minOccurs="0"/>
      <xs:element name="Description" type="xs:string" minOccurs="0"/>
      <xs:element name="Summary" type="xs:string" minOccurs="0"/>
      <xs:element name="UserRating" type="RatingType" minOccurs="0"/>
      <xs:element name="SpecificationList" type="SpecificationListType" minOccurs="0"/>
      <xs:element name="Department" type="DepartmentType" minOccurs="0"/>
      <xs:element name="Category" type="LHSType" minOccurs="0"/>
      <xs:element name="UPC" type="xs:string" minOccurs="0"/>	
      <xs:element name="Brand" type="xs:string" minOccurs="0"/>	
      <xs:element name="Model" type="xs:string" minOccurs="0"/>	
      <xs:element name="PartNumber" type="xs:string" minOccurs="0"/>	
      <xs:element name="NumOfStores" type="xs:nonNegativeInteger" minOccurs="0"/>	
    </xs:sequence>
    <xs:attribute name="ID" type="xs:nonNegativeInteger" use="required"/>
  </xs:complexType>

  <xs:complexType name="OfferType">
    <xs:sequence>
      <xs:element name="Url" type="xs:string"/>
      <xs:element name="ProductName" type="xs:string"/>
      <xs:element name="Price" type="PriceType"/>
      <xs:element name="Thumbnail" type="ImageType" minOccurs="0"/>
      <xs:element name="ListImage" type="ImageType" minOccurs="0"/>
      <xs:element name="GridImage" type="ImageType" minOccurs="0"/>
      <xs:element name="Summary" type="xs:string" minOccurs="0"/>
      <xs:element name="Merchant" type="MerchantType"/>
      <xs:element name="Department" type="DepartmentType" minOccurs="0"/>
      <xs:element name="Category" type="LHSType" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:string" use="optional"/>
  </xs:complexType>

  <xs:simpleType name="PriceType">
    <xs:restriction base="xs:decimal">
      <xs:minInclusive value="0.00"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="ImageType">	
    <xs:sequence>
      <xs:element name="Url" type="xs:string"/>
      <xs:element name="Height" type="xs:nonNegativeInteger"/>
      <xs:element name="Width" type="xs:nonNegativeInteger"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="RatingType">
    <xs:sequence>
      <xs:element name="NumReviews" type="xs:nonNegativeInteger" minOccurs="0"/>
      <xs:element name="NumRatings" type="xs:nonNegativeInteger" minOccurs="0"/>
      <xs:element name="MaxRating" type="RatingValueType"/>
      <xs:element name="AverageRating" type="RatingValueType" minOccurs="0"/>
      <xs:element name="RatingUrl" type="xs:string"/>
      <xs:element name="CreateRatingUrl" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="RatingValueType">
    <xs:restriction base="xs:decimal">
      <xs:minInclusive value="0.0"/>
      <xs:maxInclusive value="5.0"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="SpecificationListType">
    <xs:sequence>
      <xs:element name="Specification" type="SpecificationType" minOccurs="0" maxOccurs="100"/> 
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="SpecificationType">
    <xs:sequence>
      <xs:element name="SpecificationLabel" type="xs:string"/>
      <xs:element name="SpecificationValue" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="DepartmentType">
    <xs:sequence>
      <xs:element name="Name" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:nonNegativeInteger" use="required"/>
  </xs:complexType>

  <xs:complexType name="MerchantType">
    <xs:sequence>
      <xs:element name="Name" type="xs:string"/>
      <xs:element name="MaxRating" type="RatingValueType"/>
      <xs:element name="AverageRating" type="RatingValueType" minOccurs="0"/>
      <xs:element name="RatingUrl" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:nonNegativeInteger" use="required"/>
  </xs:complexType>

</xs:schema>





