Customizing XML from DataSet

J

John Knoop

Hi all!

I have a dataset filled containing one row of data. Dataset.WriteXML gives
me this:

<Article>
<Table>
<aID>10</aID>
<aHeader>Some text goes here</aHeader>
<aDate>2003-07-04T12:06:00.0000000+02:00</aDate>
<authorID>1</authorID>
<pID>2</pID>
<authorID1>1</authorID1>
<pID1>2</pID1>
</Table>
</Article>

But I would rather have it like this:

<Article>
- <Table>
<aHeader>Some text goes here</aHeader>
<aDate>2003-07-04T12:06:00.0000000+02:00</aDate>
<authorID>1</authorID>
</Table>
</Article>

Dataset.WhiteXmlSchema gives me this:

<?xml version="1.0" ?>
- <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"
msdata:Locale="sv-SE">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element name="Table">
- <xs:complexType>
- <xs:sequence>
<xs:element name="aID" type="xs:int" minOccurs="0" />
<xs:element name="aHeader" type="xs:string" minOccurs="0" />
<xs:element name="aDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="authorID" type="xs:int" minOccurs="0" />
<xs:element name="pID" type="xs:int" minOccurs="0" />
<xs:element name="authorID1" type="xs:int" minOccurs="0" />
<xs:element name="pID1" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

But I suppose I'd rather want it like this:

<?xml version="1.0" ?>
- <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"
msdata:Locale="sv-SE">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element name="Table">
- <xs:complexType>
- <xs:sequence>
<xs:element name="aHeader" type="xs:string" minOccurs="0" />
<xs:element name="aDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="authorID" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

Can anybody help me? Is there any way to force the dataset into the shape of
a user-specified schema? Or would that be the wrong approach.

/john
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top