2
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="Company">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="InventoryItemTypes"/>
        <xs:element ref="Branches"/>
        <xs:element ref="Contractors"/>
        <xs:element ref="ServiceTypes"/>
        <xs:element ref="Landlords"/>
        <xs:element ref="Properties"/>
      </xs:sequence>
      <xs:attribute name="CompanyName" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="InventoryItemTypes">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Type" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Branches">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Branch" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Branch">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Balances"/>
        <xs:element ref="Areas"/>
      </xs:sequence>
      <xs:attribute name="AccountingCode" type="xs:string" use="required"/>
      <xs:attribute name="Address1" type="xs:string" use="required"/>
      <xs:attribute name="Address2" type="xs:string" use="required"/>
      <xs:attribute name="Address3" type="xs:string" use="required"/>
      <xs:attribute name="Address4" type="xs:string" use="required"/>
      <xs:attribute name="EMail" type="xs:string" use="required"/>
      <xs:attribute name="FaxNumber" type="xs:string" use="required"/>
      <xs:attribute name="Name" type="xs:string" use="required"/>
      <xs:attribute name="PhoneNumber" type="xs:string" use="required"/>
      <xs:attribute name="Postcode" type="xs:string" use="required"/>
      <xs:attribute name="Ref" type="xs:string" use="required"/>
      <xs:attribute name="VATNumber" type="xs:string" use="required"/>
      <xs:attribute name="WebAddress" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Balances">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Balance" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Balance">
    <xs:complexType>
      <xs:attribute name="Balance" type="xs:string" use="required"/>
      <xs:attribute name="Name" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Areas">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Area" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Area">
    <xs:complexType>
      <xs:attribute name="Name" type="xs:string" use="required"/>
      <xs:attribute name="Ref" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Contractors">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Contractor" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Contractor">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="GeneralNotes" type="xs:string"/>
        <xs:element ref="BankDetails" minOccurs="0"/>
        <xs:element ref="Balances"/>
      </xs:sequence>
      <xs:attribute name="Address1" type="xs:string" use="required"/>
      <xs:attribute name="Address2" type="xs:string"/>
      <xs:attribute name="Address3" type="xs:string"/>
      <xs:attribute name="Address4" type="xs:string"/>
      <xs:attribute name="BranchRef" type="xs:string" use="required"/>
      <xs:attribute name="Country" type="xs:string" use="required"/>
      <xs:attribute name="DateOfBirth" type="xs:string"/>
      <xs:attribute name="EMail" type="xs:string"/>
      <xs:attribute name="EMailLetters" type="xs:string" use="required"/>
      <xs:attribute name="Fax" type="xs:string"/>
      <xs:attribute name="Forename" type="xs:string" use="required"/>
      <xs:attribute name="GlobalReference" type="xs:string" use="required"/>
      <xs:attribute name="LandPhone" type="xs:string" use="required"/>
      <xs:attribute name="Middlename" type="xs:string"/>
      <xs:attribute name="Mobile" type="xs:string"/>
      <xs:attribute name="NationalInsurance" type="xs:string"/>
      <xs:attribute name="Nationality" type="xs:string" use="required"/>
      <xs:attribute name="OptOutGeneralMarketing" type="xs:string" use="required"/>
      <xs:attribute name="Postcode" type="xs:string" use="required"/>
      <xs:attribute name="Ref" type="xs:string" use="required"/>
      <xs:attribute name="Surname" type="xs:string" use="required"/>
      <xs:attribute name="Title" type="xs:string" use="required"/>
      <xs:attribute name="Type" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="BankDetails">
    <xs:complexType>
      <xs:attribute name="AccountName" type="xs:string"/>
      <xs:attribute name="AccountNumber" type="xs:string"/>
      <xs:attribute name="AccountSortCode" type="xs:string"/>
      <xs:attribute name="BICSWIFTCode" type="xs:string"/>
      <xs:attribute name="BankAddress1" type="xs:string"/>
      <xs:attribute name="BankAddress2" type="xs:string"/>
      <xs:attribute name="BankAddress3" type="xs:string"/>
      <xs:attribute name="BankAddress4" type="xs:string"/>
      <xs:attribute name="BankName" type="xs:string"/>
      <xs:attribute name="BankPostcode" type="xs:string"/>
      <xs:attribute name="IBANCode" type="xs:string"/>
      <xs:attribute name="LegacyBACSReference" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="ServiceTypes">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="ServiceType" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="ServiceType">
    <xs:complexType>
      <xs:attribute name="GuaranteedRent" type="xs:string" use="required"/>
      <xs:attribute name="GuaranteedRentFee" type="xs:string"/>
      <xs:attribute name="ManageBond" type="xs:string" use="required"/>
      <xs:attribute name="ManageBondInterest" type="xs:string" use="required"/>
      <xs:attribute name="ManageBondScheme" type="xs:string" use="required"/>
      <xs:attribute name="ManageCouncilTaxLetters" type="xs:string" use="required"/>
      <xs:attribute name="ManageElectricityLetters" type="xs:string" use="required"/>
      <xs:attribute name="ManageGasLetters" type="xs:string" use="required"/>
      <xs:attribute name="ManageMaintenance" type="xs:string" use="required"/>
      <xs:attribute name="ManageNotices" type="xs:string" use="required"/>
      <xs:attribute name="ManageRent" type="xs:string" use="required"/>
      <xs:attribute name="ManageRentByDD" type="xs:string" use="required"/>
      <xs:attribute name="ManageWaterLetters" type="xs:string" use="required"/>
      <xs:attribute name="MarketManagedByAgent" type="xs:string" use="required"/>
      <xs:attribute name="MigrationManageNotices" type="xs:string" use="required"/>
      <xs:attribute name="Name" type="xs:string" use="required"/>
      <xs:attribute name="NominalCode" type="xs:string" use="required"/>
      <xs:attribute name="Ref" type="xs:string" use="required"/>
      <xs:attribute name="SendManagementReport" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Landlords">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Landlord" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Landlord">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element name="GeneralNotes" type="xs:string"/>
        <xs:element ref="BankDetails" minOccurs="0"/>
        <xs:element ref="Balances" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="Address1" type="xs:string"/>
      <xs:attribute name="Address2" type="xs:string"/>
      <xs:attribute name="Address3" type="xs:string"/>
      <xs:attribute name="Address4" type="xs:string"/>
      <xs:attribute name="BranchRef" type="xs:string" use="required"/>
      <xs:attribute name="Country" type="xs:string"/>
      <xs:attribute name="DPSCustodial" type="xs:string"/>
      <xs:attribute name="DateOfBirth" type="xs:string"/>
      <xs:attribute name="EMail" type="xs:string"/>
      <xs:attribute name="EMailLetters" type="xs:string"/>
      <xs:attribute name="Fax" type="xs:string"/>
      <xs:attribute name="Forename" type="xs:string"/>
      <xs:attribute name="GlobalReference" type="xs:string"/>
      <xs:attribute name="GuaranteedRentFeeOveride" type="xs:string"/>
      <xs:attribute name="LandPhone" type="xs:string"/>
      <xs:attribute name="ManagementFee" type="xs:string"/>
      <xs:attribute name="Middlename" type="xs:string"/>
      <xs:attribute name="Mobile" type="xs:string"/>
      <xs:attribute name="MyDeposits" type="xs:string"/>
      <xs:attribute name="NRLApplies" type="xs:string"/>
      <xs:attribute name="NRLExemption" type="xs:string"/>
      <xs:attribute name="NationalInsurance" type="xs:string"/>
      <xs:attribute name="Nationality" type="xs:string"/>
      <xs:attribute name="OptOutGeneralMarketing" type="xs:string"/>
      <xs:attribute name="Postcode" type="xs:string"/>
      <xs:attribute name="Ref" type="xs:string"/>
      <xs:attribute name="Share" type="xs:string"/>
      <xs:attribute name="Surname" type="xs:string"/>
      <xs:attribute name="Title" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Properties">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Property" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Property">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="MaintenanceJobs"/>
        <xs:element ref="Facilities"/>
        <xs:element ref="Rooms"/>
        <xs:element ref="Landlords" minOccurs="0"/>
        <xs:element ref="MaintenanceCertificates"/>
        <xs:element ref="Tenancies"/>
      </xs:sequence>
      <xs:attribute name="Address1" type="xs:string" use="required"/>
      <xs:attribute name="Address2" type="xs:string" use="required"/>
      <xs:attribute name="Address3" type="xs:string" use="required"/>
      <xs:attribute name="Address4" type="xs:string" use="required"/>
      <xs:attribute name="AddressFlatRoomNumber" type="xs:string" use="required"/>
      <xs:attribute name="AddressNumber" type="xs:string" use="required"/>
      <xs:attribute name="AreaRef" type="xs:string" use="required"/>
      <xs:attribute name="Description" type="xs:string" use="required"/>
      <xs:attribute name="Directions" type="xs:string" use="required"/>
      <xs:attribute name="ElectricityMeter1" type="xs:string"/>
      <xs:attribute name="ElectricityMeter1SerialNumber" type="xs:string"/>
      <xs:attribute name="ElectricityMeter2" type="xs:string"/>
      <xs:attribute name="ElectricityMeter2SerialNumber" type="xs:string"/>
      <xs:attribute name="ElectricityMeter3" type="xs:string"/>
      <xs:attribute name="ElectricityMeter3SerialNumber" type="xs:string"/>
      <xs:attribute name="ElectricityMeter4" type="xs:string"/>
      <xs:attribute name="ElectricityMeter4SerialNumber" type="xs:string"/>
      <xs:attribute name="ElectricityMeter5" type="xs:string"/>
      <xs:attribute name="ElectricityMeter5SerialNumber" type="xs:string"/>
      <xs:attribute name="GasMeter" type="xs:string"/>
      <xs:attribute name="GasMeterSerialNumber" type="xs:string"/>
      <xs:attribute name="Postcode" type="xs:string" use="required"/>
      <xs:attribute name="Ref" type="xs:string" use="required"/>
      <xs:attribute name="SecurityNotes" type="xs:string"/>
      <xs:attribute name="WaterMeter" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="MaintenanceJobs">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="Job" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Facilities">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="Facility" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Facility">
    <xs:complexType>
      <xs:attribute name="Type" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Rooms">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="Room" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="MaintenanceCertificates">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="MaintenanceCertificate" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Tenancies">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="Tenancy" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Job">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Description" type="xs:string"/>
      </xs:sequence>
      <xs:attribute name="AccessKeysNoAppointment" type="xs:string" use="required"/>
      <xs:attribute name="Contractor" type="xs:string"/>
      <xs:attribute name="CreatedAt" type="xs:string" use="required"/>
      <xs:attribute name="NextActionDate" type="xs:string"/>
      <xs:attribute name="NextActionNote" type="xs:string"/>
      <xs:attribute name="Priority" type="xs:string" use="required"/>
      <xs:attribute name="Status" type="xs:string" use="required"/>
      <xs:attribute name="Type" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="MaintenanceCertificate">
    <xs:complexType>
      <xs:attribute name="Description" type="xs:string" use="required"/>
      <xs:attribute name="DueAt" type="xs:string" use="required"/>
      <xs:attribute name="EPCCurrentEER" type="xs:string" use="required"/>
      <xs:attribute name="EPCCurrentEI" type="xs:string" use="required"/>
      <xs:attribute name="EPCPotentialEER" type="xs:string" use="required"/>
      <xs:attribute name="EPCPotentialEI" type="xs:string" use="required"/>
      <xs:attribute name="Responsibility" type="xs:string" use="required"/>
      <xs:attribute name="Type" type="xs:string" use="required"/>
      <xs:attribute name="ValidFrom" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Tenancy">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="ClosingInspections"/>
        <xs:element ref="Conditions"/>
        <xs:element ref="TenantTypes"/>
        <xs:element ref="InventoryItems"/>
        <xs:element ref="RentPeriods"/>
        <xs:element ref="Tenants"/>
      </xs:sequence>
      <xs:attribute name="BondScheme" type="xs:string" use="required"/>
      <xs:attribute name="CanArrangeAccess" type="xs:string" use="required"/>
      <xs:attribute name="ClosingElec1Reading" type="xs:string"/>
      <xs:attribute name="ClosingElec2Reading" type="xs:string"/>
      <xs:attribute name="ClosingElec3Reading" type="xs:string"/>
      <xs:attribute name="ClosingGasReading" type="xs:string"/>
      <xs:attribute name="ClosingInspectionCarriedOut" type="xs:string"/>
      <xs:attribute name="ClosingInspectionCarriedOutStaff" type="xs:string"/>
      <xs:attribute name="ClosingMeterDate" type="xs:string"/>
      <xs:attribute name="ClosingWaterReading" type="xs:string"/>
      <xs:attribute name="Deposit" type="xs:string" use="required"/>
      <xs:attribute name="EndDate" type="xs:string"/>
      <xs:attribute name="FixedDate" type="xs:string" use="required"/>
      <xs:attribute name="Furnished" type="xs:string" use="required"/>
      <xs:attribute name="GlobalReference" type="xs:string" use="required"/>
      <xs:attribute name="InstructionAccessArrangements" type="xs:string"/>
      <xs:attribute name="InstructionAccessMobileNumber1" type="xs:string"/>
      <xs:attribute name="InstructionAccessMobileNumber2" type="xs:string"/>
      <xs:attribute name="InstructionAccessMobileNumber3" type="xs:string"/>
      <xs:attribute name="InstructionAccessName1" type="xs:string"/>
      <xs:attribute name="InstructionAccessName2" type="xs:string"/>
      <xs:attribute name="InstructionAccessName3" type="xs:string"/>
      <xs:attribute name="InstructionSpecialCharge1" type="xs:string"/>
      <xs:attribute name="InstructionUtilityCouncilTax" type="xs:string" use="required"/>
      <xs:attribute name="InstructionUtilityElectricity" type="xs:string" use="required"/>
      <xs:attribute name="InstructionUtilityGas" type="xs:string" use="required"/>
      <xs:attribute name="InstructionUtilityTelephone" type="xs:string" use="required"/>
      <xs:attribute name="InstructionUtilityWater" type="xs:string" use="required"/>
      <xs:attribute name="IsShare" type="xs:string" use="required"/>
      <xs:attribute name="IsSigned" type="xs:string" use="required"/>
      <xs:attribute name="IsStudentProperty" type="xs:string" use="required"/>
      <xs:attribute name="MaxTerm" type="xs:string" use="required"/>
      <xs:attribute name="MinTerm" type="xs:string" use="required"/>
      <xs:attribute name="NextInspectionDue" type="xs:string"/>
      <xs:attribute name="NextRentCollectionDate" type="xs:string"/>
      <xs:attribute name="OpeningElec1Reading" type="xs:string"/>
      <xs:attribute name="OpeningElec2Reading" type="xs:string"/>
      <xs:attribute name="OpeningElec3Reading" type="xs:string"/>
      <xs:attribute name="OpeningElec4Reading" type="xs:string"/>
      <xs:attribute name="OpeningElec5Reading" type="xs:string"/>
      <xs:attribute name="OpeningGasReading" type="xs:string"/>
      <xs:attribute name="OpeningInventoryCarriedOut" type="xs:string"/>
      <xs:attribute name="OpeningInventorySignedByTenant" type="xs:string"/>
      <xs:attribute name="OpeningWaterReading" type="xs:string"/>
      <xs:attribute name="Rent" type="xs:string" use="required"/>
      <xs:attribute name="RoomsMax" type="xs:string" use="required"/>
      <xs:attribute name="RoomsMin" type="xs:string" use="required"/>
      <xs:attribute name="ServiceType" type="xs:string" use="required"/>
      <xs:attribute name="StartDate" type="xs:string" use="required"/>
      <xs:attribute name="TenancyInspectionRecurrence" type="xs:string" use="required"/>
      <xs:attribute name="TenancyInspectionSchedule" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="ClosingInspections">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="ClosingInspection" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Conditions">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element name="Condition" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="TenantTypes">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="TenantType" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="InventoryItems">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="InventoryItem" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="RentPeriods">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="RentPeriod" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="RentPeriod">
    <xs:complexType>
      <xs:attribute name="Amount" type="xs:string" use="required"/>
      <xs:attribute name="CollectionMethod" type="xs:string" use="required"/>
      <xs:attribute name="End" type="xs:string" use="required"/>
      <xs:attribute name="RentFrequency" type="xs:string" use="required"/>
      <xs:attribute name="Start" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Tenants">
    <xs:complexType>
      <xs:sequence minOccurs="0">
        <xs:element ref="Tenant" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Tenant">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="GeneralNotes" type="xs:string"/>
        <xs:element ref="BankDetails" minOccurs="0"/>
        <xs:element ref="Balances"/>
      </xs:sequence>
      <xs:attribute name="Address1" type="xs:string" use="required"/>
      <xs:attribute name="Address2" type="xs:string"/>
      <xs:attribute name="Address3" type="xs:string"/>
      <xs:attribute name="Address4" type="xs:string"/>
      <xs:attribute name="BondHeld" type="xs:string" use="required"/>
      <xs:attribute name="BranchRef" type="xs:string" use="required"/>
      <xs:attribute name="Country" type="xs:string" use="required"/>
      <xs:attribute name="DateOfBirth" type="xs:string"/>
      <xs:attribute name="EMail" type="xs:string"/>
      <xs:attribute name="EMailLetters" type="xs:string" use="required"/>
      <xs:attribute name="Fax" type="xs:string"/>
      <xs:attribute name="Forename" type="xs:string" use="required"/>
      <xs:attribute name="GlobalReference" type="xs:string" use="required"/>
      <xs:attribute name="HeadTenant" type="xs:string" use="required"/>
      <xs:attribute name="LandPhone" type="xs:string" use="required"/>
      <xs:attribute name="Middlename" type="xs:string"/>
      <xs:attribute name="Mobile" type="xs:string"/>
      <xs:attribute name="NationalInsurance" type="xs:string"/>
      <xs:attribute name="Nationality" type="xs:string" use="required"/>
      <xs:attribute name="OptOutGeneralMarketing" type="xs:string" use="required"/>
      <xs:attribute name="OutstandingRent" type="xs:string" use="required"/>
      <xs:attribute name="Postcode" type="xs:string" use="required"/>
      <xs:attribute name="RentAmount" type="xs:string"/>
      <xs:attribute name="Surname" type="xs:string" use="required"/>
      <xs:attribute name="Title" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Room">
    <xs:complexType>
      <xs:attribute name="Address1" type="xs:string" use="required"/>
      <xs:attribute name="Description" type="xs:string"/>
      <xs:attribute name="GlobalReference" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="InventoryItem">
    <xs:complexType>
      <xs:attribute name="Quantity" type="xs:string" use="required"/>
      <xs:attribute name="Type" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="ClosingInspection">
    <xs:complexType>
      <xs:attribute name="Outcome" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

Good evening all,

XML newbie here. Having used the above schema in BIDS (SQL Server 2008 r2), it's producing an error:

"... The Xml source document contains multiple "Type" elements and maxOccurs=1 was specified in the Xml schema."

Would any of you kind folks be able to point me in the right direction insofar as a resolution? I'm sure it's rather simple for those in the know, but I am pretty clueless at the best of times!

Thanks in advance,

Rob

Mathias Müller
  • 22,203
  • 13
  • 58
  • 75
HendrixAndChill
  • 91
  • 1
  • 2
  • 9

1 Answers1

4

You do not show the XML document that you validated against your schema when you got this error, so I have to guess (if this is not the solution to your problem, you definitely have to edit your question and also show the XML document).

This is the place in your XSD where a sequence of Type elements is defined:

<xs:element name="InventoryItemTypes">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Type" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

If xs:element is inside xs:sequence like this, it can have an attribute maxOccurs that specifies the maximum number of elements of this type that are allowed inside the InventoryItemTypes element. maxOccurs also has a counterpart named minOccurs.

Both maxOccurs and minOccurs have a default value of 1 if you do not set them explicitly. So, the XSD snippet above is exactly the same as writing

<xs:element name="InventoryItemTypes">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

Your XML document, I guess, has a part that looks like

<InventoryItemTypes>
  <Types/>
  <Types/>
</InventoryItemTypes>

and the schema validation complains about multiple occurrences of Types and says that "maxOccurs=1 was specified in the Xml schema" even though you did not explicitly write this in your XML schema.

See the relevant part of the XML Schema specification for much more details.

Mathias Müller
  • 22,203
  • 13
  • 58
  • 75
  • 1
    Apologies for the grossly belated gratitude, but this was exactly what I was looking for. It was applicable to a few of the elements in the end, but you taught a man to fish! – HendrixAndChill Jan 11 '16 at 17:07