XSD sequence rearranged

  • Thread starter Anders Ljusberg
  • Start date
A

Anders Ljusberg

Hi!

I have a problem.. I'm trying to get the XML from a
dataset to conform to an XSD, but it keeps rearranging
some elements.
Try this schema:

<xs:schema id="test"
targetNamespace="http://tempuri.org/test.xsd"
xmlns:mstns="http://tempuri.org/test.xsd"
xmlns="http://tempuri.org/test.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified"
elementFormDefault="qualified">
<xs:complexType name="testType1">
<xs:sequence>
<xs:element name="nestedElement"
type="mstns:testType2" minOccurs="0"
maxOccurs="unbounded" />
<xs:element name="testInt" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="testType2">
<xs:sequence>
<xs:element name="testString" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="testElement" type="mstns:testType1" />
<xs:element name="test" msdata:IsDataSet="true"
msdata:Locale="sv-SE">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element ref="testElement" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

I create a DataSet from this schema (by using
ReadXmlSchema), and then I call the GetXmlSchema method.
The result is ALMOST the same, with the difference that
the first sequence has changed. It now looks like this:
<xs:sequence>
<xs:element name="testInt" type="xs:int" />
<xs:element name="nestedElement"
type="mstns:testType2" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>

Why is this? It seems like simple types always comes ahead
of complex types. Is it by design or is it a bug?

/Anders
 
K

Kathleen Dollard

Anders,

Can you reproduce that in a very small sample so it can be bugged?

Have you tested in 1.1?
 

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