473,320 Members | 1,902 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,320 software developers and data experts.

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>AAA</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 4369
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 XmlDataTreeWriter which in turn calls
XmlDataRowWriter for each DataRow in the dataset which eventually calls
WriteString of an XmlWriter passing in the result of ConvertObjectToXml 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.HtmlDecode 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>AAA</A></COLUMN_B>
</Table>

But what I was this:

<Table>
<COLUMN_A>1</COLUMN_A>
<COLUMN_B><A>AAA</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
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...
1
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...
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...
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...
3
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...
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...
2
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...
1
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...
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.