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

Remove Dataset name as ROOT of XML

LoF
Hi,

I am generating deeply nested XML document from a Dataset
using
' Write to the file with the WriteXml method.
DataSet21.WriteXml(myXmlWriter)

The generated XML contains the <DataSet2> node as a root
node (see below) is there a way to get rid of it? I ned
the <Header> node to be a Root node. All info is generated
from database.

Thanks
LoF

<DataSet2>
<Header>
<WONo>2308100</WONo>
<EDDID>SEDD</EDDID>
....
Nov 11 '05 #1
1 4321
create an XmlDataDocument from the DataSet
http://msdn.microsoft.com/library/en...ctorTopic2.asp

then select the FirstChild. Example:

System.Xml.XmlDataDocument doc = new System.Xml.XmlDataDocument(ds);
System.Console.WriteLine(doc.FirstChild.OuterXml);
System.Xml.XmlNode n1= doc.FirstChild;
System.Console.WriteLine("\n\n" + n1.FirstChild.OuterXml); // this
strips the <DataSet> root off
"LoF" <dr***@pelab.com> wrote in message
news:0a****************************@phx.gbl...
Hi,

I am generating deeply nested XML document from a Dataset
using
' Write to the file with the WriteXml method.
DataSet21.WriteXml(myXmlWriter)

The generated XML contains the <DataSet2> node as a root
node (see below) is there a way to get rid of it? I ned
the <Header> node to be a Root node. All info is generated
from database.

Thanks
LoF

<DataSet2>
<Header>
<WONo>2308100</WONo>
<EDDID>SEDD</EDDID>
...

Nov 11 '05 #2

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

Similar topics

3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
1
by: Tom G | last post by:
The following is a small sample of my XML Data. When I load it to a dataset it only loads the 'Zone' elements and ignores loading the 'Field' elements. <zone id="1234" name="EMPLOYMENT_INFO">...
1
by: Dave | last post by:
Hi all, I've seen that many people have had this exact same problem in the past, but no-one seems to post the answer when (if) they solve it... so here we go again. If I create a strongly...
8
by: Nikhilesh Mehendale | last post by:
I have written a web service in C#, .NET 1.1 which reads a XML file into a dataset. This is just a plain XML file. First I use the Dataset.ReadXmlScheme function and pass the XML file to it. Then...
0
by: Raed Sawalha | last post by:
I have DataSet with two tables constructed as following: 1. the DataSet is initially filled by DataAdapter . 2. a new DataTable is created and filled with data returned by a stored procedure 3....
3
by: P K | last post by:
Hello, I have a dataset which is already loaded with data in one table. so dataset.tables("data") exists and has data. Now, I have to add another table to the dataset. The source for this...
2
by: MaLec | last post by:
I’d like to use the DataSet as the container for the XML files conforming to some schema. The problem is, that the operation of reading the XML file into the DataSet having its schema and then...
6
by: fzhang | last post by:
I am relatively new to XML and C#. So, forgive me if this question is too newbie. :-) While assuming this is an easy programming task, I couldn't find a single reference anywhere for how to do...
4
by: SteveT | last post by:
I am wanting to populate several treeviews, one for the <TRs> group and one for the <TGsgroup. Is there a simplier way to populate the Treeview than the one I did below? It seems difficult to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.