none
Possible bug in .NET 2.0 DataSet.ReadXml? RRS feed

  • Question

  • When using a tool generated DataSet.ReadXml method I get a ConstraintException with the following very simple XML and XSD data:

    (Retrieved from http://www.w3schools.com/schema/schema_example.asp)

    <?xml version="1.0" encoding="iso-8859-1"?>

    <shiporder orderid="889923"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:noNamespaceSchemaLocation="shiporder.xsd">

    <orderperson>John Smith</orderperson>

    <shipto>

    <name>Ola Nordmann</name>

    <address>Langgt 23</address>

    <city>4000 Stavanger</city>

    <country>Norway</country>

    </shipto>

    <item>

    <title>Empire Burlesque</title>

    <note>Special Edition</note>

    <quantity>1</quantity>

    <price>10.90</price>

    </item>

    <item xsi:nil="true"/>

    </shiporder>

     

     

     

    <?xml version="1.0" encoding="ISO-8859-1" ?>

    <xsTongue Tiedchema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xsTongue TiedimpleType name="stringtype">

    <xs:restriction base="xsTongue Tiedtring"/>

    </xsTongue TiedimpleType>

    <xsTongue TiedimpleType name="inttype">

    <xs:restriction base="xsStick out tongueositiveInteger"/>

    </xsTongue TiedimpleType>

    <xsTongue TiedimpleType name="dectype">

    <xs:restriction base="xsBig Smileecimal"/>

    </xsTongue TiedimpleType>

    <xsTongue TiedimpleType name="orderidtype">

    <xs:restriction base="xsTongue Tiedtring">

    <xsStick out tongueattern value="[0-9]{6}"/>

    </xs:restriction>

    </xsTongue TiedimpleType>

    <xs:complexType name="shiptotype">

    <xsTongue Tiedequence>

    <xs:element name="name" type="stringtype"/>

    <xs:element name="address" type="stringtype"/>

    <xs:element name="city" type="stringtype"/>

    <xs:element name="country" type="stringtype"/>

    </xsTongue Tiedequence>

    </xs:complexType>

    <xs:complexType name="itemtype">

    <xsTongue Tiedequence>

    <xs:element name="title" type="stringtype" />

    <xs:element name="note" type="stringtype"/>

    <xs:element name="quantity" type="inttype" />

    <xs:element name="price" type="dectype"/>

    </xsTongue Tiedequence>

    </xs:complexType>

    <xs:complexType name="shipordertype">

    <xsTongue Tiedequence>

    <xs:element name="orderperson" type="stringtype"/>

    <xs:element name="shipto" type="shiptotype"/>

    <xs:element name="item" maxOccurs="unbounded" type="itemtype" nillable="true"/>

    </xsTongue Tiedequence>

    <xs:attribute name="orderid" type="orderidtype" use="required"/>

    </xs:complexType>

    <xs:element name="shiporder" type="shipordertype"/>

    </xsTongue Tiedchema>

    It seems like the DataSet validation mechanism expects to see nillable or minOccurs attribute in the itemtype elements. But, VS2005 validates the pair, as does XmlSpy, and also http://www.xmlforasp.net/SchemaValidator.aspx.

    Is this a bug?

    Monday, July 16, 2007 5:12 PM

All replies