473,396 Members | 1,655 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,396 software developers and data experts.

Need to Create a Specific format with XmlTextWriter

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
1 1156
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Frank Meng | last post by:
Hi. I got some sample codes from Fig 10 of http://msdn.microsoft.com/msdnmag/issues/03/05/Real-WorldXML/default.aspx .. If I read an XML file like: <test> <good>1</good> </test> The output...
3
by: Dave | last post by:
Hi, I'm trying to create an XML document with XMLTextWriter but I want to store it in memory (not write it to a file like so many examples do). I tried the following but with no luck. Should I not...
7
by: pintihar | last post by:
Hi, As a follow on from an earlier post I have another question about xslt. Is it possible to create the stylsheet programatically? Is this sensible? In the first phase I needed to map element...
2
by: Wayne Wengert | last post by:
This is my first attempt to re-write an old VB6 application that exported a CSV file to a .NET application that exports an XML file with the equivelent data. I have limited understanding of OO...
1
by: Bruno | last post by:
Hello friends I want to crete an xml file based on a sql server query, and using a specific format that include current hour, current date, the user that create the xml file. I'm thinking in...
1
by: Mike P | last post by:
I am trying to create a new file and write to it, but I keep getting the error 'cannot access the file because it is being used by another process'. Can anybody help me out? long lngNextNumber...
4
by: John Salerno | last post by:
I thought I might use the XML functions in C# to help me do some repetitive typing in an XHTML file, but I'm stuck. Here's what I have before I just stopped: void WriteXMLFile() { string path...
1
by: jens Jensen | last post by:
Hello , i'm calling a webservice generated with oracle webservice java tools. I'm not able to add a web reference to a .net client the usual way with visual studio 2005. I was therefore...
1
by: jschell | last post by:
The following two cases behave differently in Net 2.0. The Case_Create_StringWriter throws an exception while the Case_XmlTextWriter does not. Is there a problem with this code? Or is this a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.