PC Review


Reply
Thread Tools Rate Thread

DataSet.ReadXml and Empty Elements creating duplicate data

 
 
Alejandro Calbazana
Guest
Posts: n/a
 
      3rd Sep 2003
Hello,

I am having trouble with the DataSet.ReadXml() method. While loading
a dataset containing empty elements having the same name as a parent
level node located elsewhere in my document, I noticed duplicate rows
in my newly loaded dataset (as well as duplicate elements when written
out to file).

My dataset resembles:

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Test>
<Sample>1</Sample>
<Comments />
</Test>
<Comments>
<CommentID>13936</CommentID>
<CommentText>Test of comment area.</CommentText>
</Comments>
</NewDataSet>

After loading this into a DataSet, and writing out the "Comments"
DataTable to file I find this:

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Comments/> <!-- huh??? -->
<Comments>
<CommentID>13936</CommentID>
<CommentText>Test of rent roll comment area.</CommentText>
</Comments>
</NewDataSet>

Note the extra empty Comments DataRow/Xml Element.

Is this a known issue with loading DataSets from Xml? What rules
should I conform to in order to load Xml into a DataSet properly?

This occurs with out without applying a schema before reading in the
xml. In fact, I ran into this while using an xsd as I could not
explain why the schema kept failing my xml load.

Any help is appreciated.

Thanks,

Alejandro
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
null value in xml translates to empty string in dataset after ReadXML BillE Microsoft ADO .NET 1 25th Apr 2008 10:48 PM
Re: does DataSet.ReadXml() clear current table information on DataSet CrunkByte Microsoft Dot NET Framework 0 21st May 2005 03:11 AM
Readxml diffgram: returns empty dataset Mav Microsoft ADO .NET 0 28th Jan 2005 03:45 PM
How to get the data from the dataset in an attribute format rather than Elements =?Utf-8?B?TWF0dA==?= Microsoft ADO .NET 1 30th Mar 2004 03:41 PM
ReadXML and Empty Elements in XML Atul Agarwal Microsoft ADO .NET 2 23rd Oct 2003 08:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:01 AM.