G
Guest
I am attempting to apply a schema to a data set, and it doesn’t seem to work
at all. It’s like my data set completely ignores ReadXMLSchema. To test this,
I ran the code below:
ds.ReadXmlSchema("E:\\ foo.xsd");
Response.Write("<pre>");
Response.Write(System.Web.HttpUtility.HtmlEncode(ds.GetXmlSchema()));
Response.Write("</pre>");
What is written out does not match what is in my foo.xsd file.
foo.xsd looks like this:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="SampleQuarter" type="xs:string"
minOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
This is what is written out. Notice the change in type and minOccurs.
<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="SampleQuarter" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Any help would be appreciated.
at all. It’s like my data set completely ignores ReadXMLSchema. To test this,
I ran the code below:
ds.ReadXmlSchema("E:\\ foo.xsd");
Response.Write("<pre>");
Response.Write(System.Web.HttpUtility.HtmlEncode(ds.GetXmlSchema()));
Response.Write("</pre>");
What is written out does not match what is in my foo.xsd file.
foo.xsd looks like this:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="SampleQuarter" type="xs:string"
minOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
This is what is written out. Notice the change in type and minOccurs.
<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="SampleQuarter" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Any help would be appreciated.