473,856 Members | 1,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetXml() method in DataSet -- Problem

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.

Let us say, my dataSet looks like this after the select query:

COLUMN_A COLUMN_B
1 <A>AAA</A>

I expected the GetXml() method to return me the following:

<Table>
<COLUMN_A>1</COLUMN_A>
<COLUMN_B><A>AA A</A></COLUMN_B>
</Table>

But what I was this:

<Table>
<COLUMN_A>1</COLUMN_A>
<COLUMN_B>&lt;A &gt;AAA&lt;/A&gt;</COLUMN_B>
</Table>

Basically the GetXml() method is treating the XML in Column B as text
which I don't want.

I want the GetXml() to treat the Column B value as subnode in the
returned xml.

Is there anyway to do this?

Appreciate your help.

thanks,
Rajesh

Nov 17 '05 #1
2 4388
I've just spent the last 10 minutes use Reflector to look through the
different methods on a DataSet for saving it to XML. From what I can see the
GetXml call calls the internal class XmlDataTreeWrit er which in turn calls
XmlDataRowWrite r for each DataRow in the dataset which eventually calls
WriteString of an XmlWriter passing in the result of ConvertObjectTo Xml of
what is presumably the StringStorage class.... which returns the exact string
as it is in the database.

However, ..... and on we go. Suffice to say, the string is encoding along
the way. I can't see a way, other then to write your own encoder to get
around the problem of GetXml encoding it.

However, if you do have a deterministic way of knowing where in the
resultant string representing the XML that the encoded values appear, you
could create an XmlDocument from it, go to that string and then call
HttpUtility.Htm lDecode on the contents.

Sorry I couldn't be of more help.

Brian Delahunty
Ireland

"Rajesh AVRS" wrote:
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.

Let us say, my dataSet looks like this after the select query:

COLUMN_A COLUMN_B
1 <A>AAA</A>

I expected the GetXml() method to return me the following:

<Table>
<COLUMN_A>1</COLUMN_A>
<COLUMN_B><A>AA A</A></COLUMN_B>
</Table>

But what I was this:

<Table>
<COLUMN_A>1</COLUMN_A>
<COLUMN_B><A>AA A</A></COLUMN_B>
</Table>

Basically the GetXml() method is treating the XML in Column B as text
which I don't want.

I want the GetXml() to treat the Column B value as subnode in the
returned xml.

Is there anyway to do this?

Appreciate your help.

thanks,
Rajesh

Nov 17 '05 #2
Thank you for your help Brian... I will give it a shot with HttpUtility

Nov 17 '05 #3

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

Similar topics

0
604
by: softengine | last post by:
I have a dataset with multiple tables I need exported to Excel. I can get it into Excel into one worksheet however I want there to be one worksheet for each datatable in the dataset. If I dump my xml string from the getXML method into Excel it puts all the data from the tables into the same worksheet. I am using the XMLImportXML method that's available with Office 2003. Do I have to loop through each datatable and use getXML and...
1
3522
by: Mark | last post by:
I have a basic question about xml encoding and predefined characters in xml. I know that characters such as "<" get encoded to &lt; My question is when does this actually happen? I'm using the getxml() method of a dataset to build my xml, but before I send it to the server, I prepend an encoding scheme of UTF-8. Does just adding this declaration correctly encode the characters on the way to the server or does it already expect them to be...
4
4526
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.
1
2023
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
3
4544
by: Mark | last post by:
I have run into a problem that I have not found an easy solution for. My data all resides in a dataset and we're using getxml to return the xml and send that on to the webserver for processing. It seems though that the getxml method always wants to create formatted xml (see example below). I don't want it like that and want it in a single line. I haven't been able to find an easy way to do this, because I can't just strip spaces/crlf...
1
1853
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...
2
1286
by: Ganesh Muthuvelu | last post by:
Hello, I have a schema that contains two "choice" elements, say "F1" and "F2" - meaning either F1 or F2 can be present but not both. I loaded this schema into a dataset, which created two columns in the datatable "F1" and "F2". Now, I load the dataset with a value for F1 and not for F2. When I use the GetXML method of the dataset, the output produces both elements F1 and F2, like shown below: <F1>value1</F1>
1
1267
by: lucky | last post by:
Hi guys! i'm facing very strange problem. i've a DataSet object in which i add some tables the some logic finishes successfully. and after then i tried to get the XML string from the DataSet but it returns only first 2 tables in that string. here is the code that i'm using to add tables into the DataSet and then tried to get the xml from the dataset
1
1624
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 :
0
9903
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9755
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
10376
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...
1
7928
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7084
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5954
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4567
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
4168
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3194
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.