473,396 Members | 1,678 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.

Problem with dataset.getxml

Hi

I am trying to convert a dataset to xml using dataset.getxml.
But this xml doesn't contain elements for null columns that are present in the dataset. How can we explicitly control this behaviour

Suppose I have this dataset

Col1 Col2 Col3 Col
----- ---- ---- ---
A1 A2 A3 A
B2 B3 B
C1 C2 C3 C

It can be noted that (Column1, Row2) element is blank. Now when I convert this dataset to xml using dataset.getxml, I get the following xml

<NewDataSet><Table><Col1>A1</Col1><Col2>A2</Col2><Col3>A3</Col3><Col4>A4</Col4></Table><Table><Col2>B2</Col2><Col3>B3</Col3><Col4>B4</Col4></Table><Table><Col1>C1</Col1><Col2>C2</Col2><Col3>C3</Col3><Col4>C4</Col4></Table></NewDataSet

As it can be noticed in the above xml, <Col1></Col1> element set is missing in the second <Table> node set.
If I want this in the xml, What do I have to do ? I tried using ds.WriteXML instead of getXML, but no luck. Any help would be highly appreciated. Thanks
----------------------------------------------------------------------------
Please remove "NO_SPAM" from my e-mail address while replying
------------------------------------------------------------------------------
Nov 18 '05 #1
1 1999
Hi Kashyap,

You can use for serialization and deseralization (which is not possible with
GetXML) also this routine. (Both without schema as in GetXML).
\\\
' Serialization
Dim sw As New System.IO.StringWriter
ds.WriteXml(sw)
Dim mystring As String = sw.tostring

'Deserialization
Dim sr As New System.IO.StringReader(mystring)
Dim ds2 As New DataSet
ds2.ReadXml(sr)
///
I hope this helps,

Cor
Nov 18 '05 #2

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

Similar topics

1
by: mr_dom_is | last post by:
Hi I have a little bit of trouble, probably missing the point now sure but: I have a dataset dim ds as new dataset("User") Which is populated with data from a database. When I use
1
by: Sunny | last post by:
Hi, I am trying to use the GetXml() function of my DataSet, and its returning all the rows and their values correctly in Elements format. How can i change this default behaviour of the GetXml()...
4
by: Chris | last post by:
I apply a dataview with a filter to a datagrid to remove rows that a user does not want to see. However when I attempt to extract the data from the underlying dataset using GetXML() the entire...
2
by: Rajesh AVRS | last post by:
Hi guys I have a requirement where I needed to extract the DataSet contents as XML. After filling the dataset, I am calling GetXml() and is working fine. However, one of the column which I...
1
by: Kashyap | last post by:
Hi I am trying to convert a dataset to xml using dataset.getxml. But this xml doesn't contain elements for null columns that are present in the dataset. How can we explicitly control this...
0
by: mr_dom_is | last post by:
Hi I have a little bit of trouble, probably missing the point not sure but: I have a dataset dim ds as new dataset("User") Which is populated with data from a database. When I use
1
by: Elad | last post by:
hi, I'm sorry if this isn't the right group, I just didnt know which category to place this question in. Anyway, I have 2 problems: I got a web service which connects to a DB and puts the data in...
1
by: lucky | last post by:
Hi guys! i've filled the DatSet object and was trying to get xml data from it. i used GetXml() method for that. it worked fine when all columns of the datatable has data. it generates perfectly...
3
by: Greg Collins [Microsoft MVP] | last post by:
I have a SQL2005 XML column I load into a DataSet. I then bind to a DataGrid. If I set an asp:Literal text value to the DataSet.GetXml() when I first load it into the DataSet, it displays...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
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,...

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.