DataSet ReadXmlSchema fails on a schema with (xsd:)imported schema

E

Eric van Wijk

Hi,

When I try to assign a schema to a dataset using the ReadXmlSchema method,
that schema does not import any schemas included with xs:import. Both
schema's are stored in the assembly as embedded resources (in the same
namespace).:


The Code:
templateDocument = new XmlDataDocument();
Assembly classLibrary = Assembly.GetExecutingAssembly();
Stream schemaStream =
classLibrary.GetManifestResourceStream("My.Namespace.Schema.xsd");
templateDocument.DataSet.ReadXmlSchema(schemaStream);
The Schema:
<?xml version="1.0" encoding="utf-8" ?>

<xs:schema id="template" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:import="urn-dummy-state">

<!--ATTENTION: This schema contains references to other imported schemas-->

<xs:import namespace="urn-dummy-state" schemaLocation="import.xsd" />

<xs:element name="template" msdata:IsDataSet="true" msdata:Locale="nl-NL"
msdata:EnforceConstraints="False">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element name="random">

<xs:complexType>

<xs:sequence>

<xs:element name="li" nillable="true" minOccurs="0" maxOccurs="unbounded">

<xs:complexType>

<xs:simpleContent msdata:ColumnName="li_Text" msdata:Ordinal="1">

<xs:extension base="xs:string">

<xs:attribute ref="import:condition" />

</xs:extension>

</xs:simpleContent>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

</xs:element>

</xs:schema>


What do I do wrong (if any)?

Thx in adv.

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top