j will
j will

Reputation: 3807

System.Data.DataSet is not Completely Reading the XML File

I am using NDbunit to unit test the functionality of my methods and database. For NDbunit to work, it firsts loads an xml schema file (.xsd) and then reads in the xml file with all the data that will be populated into the database. Here is my xml schema file MessageDS.xsd:

<xs:schema id="MessageDS"
 xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" 
 xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
 targetNamespace="http://tempuri.org/MessageDS.xsd"
 elementFormDefault="qualified"
 xmlns="http://tempuri.org/MessageDS.xsd"
 xmlns:mstns="http://tempuri.org/MessageDS.xsd"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:element name="MessageDS" msdata:IsDataSet="true" msdata:UseCurrentLocalexmlns="true" msprop:Generator_MessageDSName="MessageDS" msprop:Generator_DataSetName="MessageDS">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="MESSAGE">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="CREATED_AT" type="xs:dateTime" />
              <xs:element name="SUBJECT" type="xs:string" />
              <xs:element name="MESSAGE" type="xs:string" />
              <xs:element name="FROM" type="xs:string" />
              <xs:element name="TO" type="xs:string" />
              <xs:element name="TO_EMAIL" type="xs:string" />
              <xs:element name="EMAIL_SENT_AT" type="xs:dateTime" />
            </xs:sequence>
            <xs:attribute name="ID" type="xs:int" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

Here is my xml data file Message.xml:

<MessageDS xlmns="http://tempuri.org/MessageDS.xsd">
  <MESSAGE ID="1">
    <FROM>Test User 2</FROM>
    <TO>Test User 1</TO>
  <MESSAGE>
</MessageDS>

Initially I was just using the dll references for NDbunit but eventually I downloaded the source code and started debugging through the problems. I noticed that after the xml schema file is read in the xml file is not being properly loaded into the dataset (System.Data.DataSet). The only xml that is written in is:

<MessageDS xmlns="http://tempuri.org/MessageDS.xsd" />

For some reason my MESSAGE objects are not being read into the xml file. I'm not sure if this is because my xml file is not properly created according to the xml schema file or something else is the cause. I tried to follow the examples on the https://code.google.com/p/ndbunit/wiki/QuickStartGuide for NDbunit and I also looked at the xml files in the testing files for NDbunit.

Upvotes: 2

Views: 266

Answers (1)

user3704367
user3704367

Reputation: 46

To start with, "xlmns" is misspelled: <MessageDS xlmns="http://tempuri.org/MessageDS.xsd">

Upvotes: 3

Related Questions