473,756 Members | 6,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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><Ta ble><Col1>A1</Col1><Col2>A2</Col2><Col3>A3</Col3><Col4>A4</Col4></Table><Table><C ol2>B2</Col2><Col3>B3</Col3><Col4>B4</Col4></Table><Table><C ol1>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 2021
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.Strin gWriter
ds.WriteXml(sw)
Dim mystring As String = sw.tostring

'Deserializatio n
Dim sr As New System.IO.Strin gReader(mystrin g)
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
5821
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
1626
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() function to return the embedded nodes as an Attribute of an entity and not ChildNodes, e.g. The DataSet's GetXml function returns like this <File> <FileName>some.xml</FileName>
4
4525
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 dataset is returned. Is there a method of getting the XML from the dataview / datagrid / dataset that applies the filter applied in the dataview? Thanks in advance.
2
4386
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 am querying, is CLOB data in XML format.
1
1118
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 behaviour Suppose I have this dataset Col1 Col2 Col3 Col ----- ---- ---- --- A1 A2 A3 A
0
1476
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
1850
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 a DataSet, and sends back to the user the DataSet.GetXml() (I know that a Dataset is serializable, but i need it's xml. anyway, this method does not create tags with no values in the output xml, in case a certain field in the DB equals...
1
1621
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 fine xml but when if one column in datatable has no data(null), the method doesnt generates xml for that column. for example :
3
2103
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 correctly. If I later try to display the XML content in the asp:Literal control, then I get "<NewDataSet />". Why is that? Why can't I get the actual XML back from the DataSet? I'm new to DataSets, so I'm probably just missing something basic. Here's...
0
9297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9735
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
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 we have to send another system
2
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.