473,487 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to write XML Data from DataSet problem?

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. DataSet ds = new DataSet();
  2. ds.ReadXml(new StringReader("INPUT.XML"), XmlReadMode.InferSchema);
  3.  
  4. int oTableNumber = 2;
  5. DataRow oRow = ds.Tables[oTableNumber].NewRow();
  6. oRow[0] = 3;
  7. oRow[1] = "event-id3";
  8. ds.Tables[oTableNumber].Rows.Add(oRow);
  9.  
  10. XmlTextWriter xtw = new XmlTextWriter("OUTPUT.XML", Encoding.UTF8);
  11. ds.WriteXml(xtw, XmlWriteMode.IgnoreSchema);
  12.  
HERE is my INPUT.XML file
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <request date="1900-01-01" package="1" event-type="E03">
  3.     <event-E03>
  4.         <request-portout-list-element>
  5.             <veryfication-type>1</veryfication-type>
  6.             <event-id>event-id1</event-id>
  7.         </request-portout-list-element>
  8.         <request-portout-list-element>
  9.             <veryfication-type>2</veryfication-type>
  10.             <event-id>event-id2</event-id>
  11.         </request-portout-list-element>
  12.     </event-E03>
  13. </request>
  14.  
  15.  
and here is the OUTPUT.XML ???
Expand|Select|Wrap|Line Numbers
  1. <request date="1900-01-01" package="1" event-type="E03">
  2.     <event-E03>
  3.         <request-portout-list-element>
  4.             <veryfication-type>1</veryfication-type>
  5.             <event-id>event-id1</event-id>
  6.         </request-portout-list-element>
  7.         <request-portout-list-element>
  8.             <veryfication-type>2</veryfication-type>
  9.             <event-id>event-id2</event-id>
  10.         </request-portout-list-element>
  11.     </event-E03>
  12. </request>
  13. <request-portout-list-element>
  14.     <veryfication-type>3</veryfication-type>
  15.     <event-id>event-id3</event-id>
  16. </request-portout-list-element>
  17.  
Why does the OUTPUT.XML look like this?
Look at the 'REQUEST-PORTOUT-LIST-ELEMENT' element at the bottom of the xml?
Oct 28 '10 #1
0 1072

Sign in to post your reply or Sign up for a free account.

Similar topics

0
347
by: octaviansen | last post by:
Hi, I am experiencing some weird problems with an ASP.NET web application that is making use of System.Data.DataSet and System.Data.DataRow classes. On a machine with single CPU, the...
0
1445
by: chris.millar | last post by:
I am using the ReadXMLSchema method of system.data.dataset to read a schema into a dataset. I have an XML file that I build up and wish to do a .Update against a database. The dataset doesn't...
0
786
by: Guy Murray | last post by:
I have 2 tables in a microsoft access db. The first table has two field: media and code. The second table has: code, price. I have a drop down list that is databound to the first table with the...
1
4392
by: Greg Cyrus | last post by:
Hi, i have created a function to open a Databse by OLEDB and fill it into a System.Data.DataSet-Objekt by oleDBAdapter.Fill-Mehtod.. Now I want to assign this DataSet to a normal...
1
2892
by: John Young | last post by:
Hi, I have a strange problem with returning a dataset from a webservice. Here's some code... The error I get at compile time is. "Cannot convert type 'void' to 'System.Data.DataSet'" Can...
1
9332
by: Optimus | last post by:
Hi everyone, I currently develop an application in vs.net 2005 with vb.net. I was trying to use typed dataset and I've got in trouble for converting untyped dataset into Typed DataSet. I don't...
7
1778
by: Bob | last post by:
Hi, I have a typed unbound dataset that is passed to a datahandling class to be filled. The datahandling class fills it from a sproc using an oledbDataAdapter (SQLAnywhere database) The only...
6
9065
by: marylipscomb | last post by:
I am using VB.NET. I am trying to connect a button so that when it is clicked the gridview pops up the data. Partial Class Switchboard Inherits System.Web.UI.Page Protected Sub...
3
1650
prabunewindia
by: prabunewindia | last post by:
Hi, for my project, i am using session to store the user's information like userid, username... Also i am storing the dataset, which is having the datas for the particular user to avoid trip to...
0
1311
by: klia | last post by:
hey folks i am facing this problem in my following codes where i am trying to create a database using pysqlite and load data from text file where data is arranged in this form...
0
7108
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
7181
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...
1
6847
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...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.