My XML Schema, XML, and DataSet Won't Coexist in Peace RRS feed

  • Question

  • I've searched far and wide for an answer to this and have come up with nothing that has worked.

    I'm writing middleware to talk to a third party vendor and I'm trying to get their XML and XML Schema to play nice with a DataSet. Sounds easy right? I hope someone will think so.

    Here is a sample block of the XML:

    Code Block




    Here is a sample block of the XML Schema:

    Code Block

    <xs:element name="questions" maxOccurs="1" minOccurs="0">
        <xs:sequence maxOccurs="unbounded" minOccurs="0">
          <xs:element name="question">
              <xs:sequence maxOccurs="1" minOccurs="1">
                <xs:element name="prompt" type="xs:string" maxOccurs="1" minOccurs="1" />
                <xs:element name="type" type="xs:string" maxOccurs="1" minOccurs="1" />
                <xs:sequence maxOccurs="6" minOccurs="6">
                  <xs:element name="answer" type="xs:string" />

    I've bolded the trouble areas. I'm using the ReadXmlSchema() and ReadXml() method of populating my DataSet and always the 'question' DataTable generated has only 3 columns (prompt, type, and answer).

    This makes perfect sense because you can't have more than one column with the same name.

    My unfortunate task is finding a way around it. Any help will be greatly appreciated.

    Tuesday, November 13, 2007 10:44 PM


All replies