PC Review


Reply
Thread Tools Rate Thread

ADO.NET and XML Schemas: Generating the XML using the DataSet

 
 
=?Utf-8?B?TmF1bWFuIEFobWVk?=
Guest
Posts: n/a
 
      3rd Mar 2005
Hi,

I have to prepare a XML file in the following format:

<CompanyOrders>
<CompanyProfile>
<CompanyID>Test</CompanyID>
<CompanyName>The Company</CompanyName>
</CompanyProfile>
<OrderInformation>
<BuyerInformation>
<OrderNo>00001</OrderNo>
<FName>John</FName>
<LName>Doe</LName>
</BuyerInformation>
<CustomerEMailInformation>
<EmailAddr>(E-Mail Removed)</EmailAddr>
<CustomerEMailInformation>
<CreditCardInformation>
<CcType>MA</CcType>
<ExpYear>09</ExpYear>
</CreditCardInformation>
</OrderInformation>

This information will come from one table CustomerOrder. Here are my
questions:

1. I suspect I will have to create multiple data adapter as
<CustomerEMailInformation> exist outside the <BuyerInformation>.
2. The code that I have written untile now:

DataSet dsOrders = new DataSet("CompanyOrders");
this.dsOrders.Tables.Clear();
SqlDataAdapter sdaOrder = new SqlDataAdapter(this.strSQL,conn);
sdaOrder.Fill(this.dsOrders,"OrderInformation");
conn.Close();
this.dsOrders.WriteXml("C:\\test.xml",XmlWriteMode.IgnoreSchema);

And the XML output is as follows:

<CompanyOrders>
<OrderInformation>
<OrderNo>I000004</OrderNo>
<FName>Nauman</FName>
<MI />
<LName>Ahmed</LName>
<CoName>Company</CoName>
<Street>Address</Street>
<City>City</City>
<State>State</State>
<ZipCode>Zip</ZipCode>
<CountryCode>1000</CountryCode>
<DayPhone>000-000-0000</DayPhone>
</OrderInformation>
</CompanyOrders>

I need the information contained in the
<OrderInformation></OrderInformation> tags to be contained in
<BuyerInformation></BuyerInformation> tags as it is defined in the DTD. Any
suggestions?

Thanks, Nauman.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can xml schemas from a dataset be used to validate standard xml files? Andy B Microsoft ASP .NET 0 7th Aug 2008 12:42 AM
Comparing dataset schemas? Leon_Amirreza Microsoft ADO .NET 0 11th Aug 2007 05:55 AM
Ensuring uniqueness of a 'record' when using XML schemas with a DataSet DotNet Ed Microsoft ADO .NET 0 9th Oct 2004 02:16 AM
Mapping fields of two dataset schemas Ben Boer Microsoft ADO .NET 1 1st May 2004 11:00 AM
generating dataset angelina Microsoft VB .NET 2 13th Oct 2003 09:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:31 AM.