By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,210 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,210 IT Pros & Developers. It's quick & easy.

Need to Create a Specific format with XmlTextWriter

P: n/a
c#
I have a typed-dataset of items that need to be written to an xml file
in a specific format. Writing the Xml file is the easy part. How
difficult is it to write an output with the following format:

<root>
<productGroup productGroupId="1">
<product productId="1" price="2.00" />
<product productId="4" price="3.42" />
<product productId="6" price="0.90" />
</productGroup>
<productGroup productGroupId="2">
<product productId="7" price="2.00" />
<product productId="8" price="3.42" />
<product productId="9" price="0.90" />
</productGroup>
</root>

For each productGroup node I would like to have 3 products. The
productId's and price are being pulled from the database. There are
usually 20-25 productGroupId's so I need to have an outer loop from 0
< 20-25 ( exact number pulled from database as well ) as well as a
loop that counts how many products are added to each productGroup.

For an example let's say that there are 60 products and 20
productGroups that need to be populated. This makes for a nice number
of 3 products per productGroup.

I would also need the functionality to accommodate 59 products and
maybe 22 productGroups. This means that productGroups 1 - 19 would
have 3 items each, 20 would have 2, and 21 & 22 would have 0.

How difficult would it be to pull this off?

Jan 31 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
c#
On Jan 31, 10:24 am, "c...@willasrari.com" <gro...@willasrari.com>
wrote:
I have a typed-dataset of items
Sorry. DataTable.

Jan 31 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.