473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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>jo*****@johndoe.com</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.
Jul 21 '05 #1
0 886

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jack Notarangelo | last post by:
Hello, I am interested in anyone's preference as to creating datasets in code vs generating them using the UI. I know typing is an advantage of the latter method. But any other information...
2
by: sam | last post by:
Hi, I've been buried in xsl and xslt articles for several days now, and am still unsure as to what I need to do... Basically, my vb.net app loads up an XML file from an external source...
2
by: AlexS | last post by:
Hello all! Are there any limitations know for schemas (xsd), which could be processed by DataSet.ReadXMLSchema method? I have problem when reading one of schemas. .Net complains and people say...
10
by: Al Christoph | last post by:
Please forgive me if this is the wrong place to post this. The last place I posted got me a fairly rude response. I guess vb.db people just don't want to think about XML as database. At any rate,...
1
by: xxxxyz | last post by:
Hi, I want to generate dataset class using Visual studio ( I can do this as first generate SqlDataAdaptor and SqlConnection). But can I ganerate it without sqldataadaptor and sqlconnection,...
3
by: Anthony | last post by:
Hi There When trying to add a dataset to a web form I get the following error msg. "There were problems generating . To resolve this problem build the project, fix the errors and generate...
0
by: Nauman Ahmed | last post by:
Hi, I have to prepare a XML file in the following format: <CompanyOrders> <CompanyProfile> <CompanyID>Test</CompanyID> <CompanyName>The Company</CompanyName> </CompanyProfile>...
0
by: dlutz | last post by:
Good day to all -- I have been trying to load a dataset from XML based on a multi-level schema structure that uses <xsd:importtags to bring other schemas into the XML document context - Schema1...
1
by: Leon_Amirreza | last post by:
Hi, How can I comapre 2 dataset schemas are compatible (Same table columns, same keys, same constraints, ...)?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.