XML Schema Query - maxOccurs?

时间:2016-01-07 22:24:33

标签: xml xsd sql-server-2008-r2 schema bids

<?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>

晚上好,

XML新手在这里。在BIDS(SQL Server 2008 r2)中使用了上述模式后,它产生了一个错误:

  

&#34; ... Xml源文档包含多个&#34; Type&#34;在Xml架构中指定了元素和maxOccurs = 1.&#34;

在解决问题的过程中,你们中的任何一个人都能指出正确的方向吗?我相信对于那些知情人士来说这很简单,但我在最好的时候都很无能为力!

提前致谢,

罗布

1 个答案:

答案 0 :(得分:3)

当您收到此错误时,您不会显示针对您的架构验证的XML文档,因此我必须猜测(如果这不是您的问题的解决方案,您必须编辑您的问题并显示XML文件)。

这是XSD中定义Type元素序列的位置:

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

如果xs:element位于此xs:sequence内,则可以使用属性maxOccurs来指定InventoryItemTypes元素中允许的此类型的最大元素数。 maxOccurs也有一个名为minOccurs的对应方。

如果您未明确设置,maxOccursminOccurs默认值均为1。因此,上面的XSD片段与编写

完全相同
<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>

我猜你的XML文档有一个看起来像

的部分
<InventoryItemTypes>
  <Types/>
  <Types/>
</InventoryItemTypes>

并且模式验证会抱怨Types多次出现,并且表示在Xml架构中指定了&#34; maxOccurs = 1&#34;即使你没有在XML模式中明确地写这个。

有关详细信息,请参阅relevant part of the XML Schema specification