locked
XML Validation with XSD fails because of xs:sequence for complexType RRS feed

  • Question

  • Hi,

    I have xsd which has complextype elements with xs:sequence to maintain the order of child elements inside the parent element. I am using dataset to read the xsd and read the data from some other text file.

    After creating the xml file (by using dataset.GetXml();) i am validating the xml file against the xsd. But validation is getting failed.

    I unerstand that if i change xs:sequence to  xs:all then validation error will not come. But i want to maintain the order in xml file. and more important is i dont want to do any change in xsd file.

    Please help me on this ASAP.

    sample XSD data as below :  

    <xs:complexType name="testdata">
        <xs:sequence>
          <xs:element ref="Cur1" minOccurs="0"/>
          <xs:element ref="SecIDSource" minOccurs="1" maxOccurs="1"/>
          <xs:element ref="SecId" minOccurs="1" maxOccurs="1"/>
          <xs:element ref="Symbol" minOccurs="0"/>
          <xs:element ref="SecurityDesc" minOccurs="0"/>
          <xs:element ref="SettlCurrency" minOccurs="0"/>
          <xs:element ref="MaturityMonthYear" minOccurs="0"/>
          <xs:element ref="StrikePrice" minOccurs="0"/>
          <xs:element ref="SecurityExchange" minOccurs="0"/>
          <xs:element ref="ContractMultiplier" minOccurs="0"/>
        </xs:sequence>
     </xs:testdata>

     

     

    Thursday, August 14, 2014 11:28 AM