Groups | Blog | Home
all groups > dotnet xml > july 2006 >

dotnet xml : XMLDesigner XSD DataSet Order with Relationships


Andrew Brook
7/20/2006 12:00:00 AM
Hiya,

I don't suppose you could post your xsd schema? Or confirm that your schema
explicitly says that the elements must appear in that order. I'm no expert
on XML or on DataSet's but that's the first thing id check :)

ta,
Andrew

[quoted text, click to view]

Computer
7/20/2006 2:26:21 AM
I brought an XSD into the XMLDesigner. The XSD had two related tables and
it looked like this in .Net's XMLDesigner:



Table 1

---------

BankItem (Bank Item)

Person (Person)

Acct String

Balance Decimal

Date String

Regulation String





Table 2

---------

Person (Person)

FirstName String

LastName String

Phone String





In my project I wanted to load the resulting Dataset with data and then use
the Dataset.WriteXML command to produce the XML file. I want the tags in
the output XML file to be in the order specified in the XSD file and as
shown on the XMLDesigner in .Net. I used:

myXmlDataDocument = New XmlDataDocument

myXmlDataDocument.DataSet.ReadXmlSchema()

I then added rows to the tables and wrote the XML file with
Dataset.WriteXML. My process works except the Dataset that is built by the
XMLDesigner puts the (Person) related tag at the bottom of the BankItem area
below the Regulation element instead of above the Acct element as shown in
the designer. My XML is nested properly, it is just in the wrong order.



If I Right-Click the XMLDesigner and Click "Preview Dataset" under BankItem
I see:

Acct

Balance

Date

Regulation

BankItem ID (Key Field)

BankItem Person (Relation with its type under it)



The designer is throwing the relation to the bottom of the first table's
element list, which affects the Dataset I am using. Can I override this and
put my relation back at the top where it is in my XSD?







AddThis Social Bookmark Button