473,320 Members | 1,950 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.

Convert an xml document to a string or stringbuilder?

Hello. I am relatively new to using XML, but I'm trying to convert an xml
document directly to a string or stringbuilder. I'm trying to use the
XmlDocument class and Stringwriter classes, but I am unsucessful. What am I
missing? Thank you for your help in advance!

--
Steve
Nov 12 '05 #1
3 16192
Hi Steve,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the whole xml document
as a string to a string object. If there is any misunderstanding, please
feel free to let me know.

In this case, we can use XmlDocument.OuterXml to get the whole document as
a string. Here's an example:

XmlDocument doc = new XmlDocument();
doc.Load(@"c:\a.xml");
this.textBox1.Text = doc.OuterXml;

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
Thanks Kevin. That's what I'm looking for, however, I am using the 2.0
framework. The OuterXML has moved somewhere else. Any ideas where? Thank
you!

"Kevin Yu [MSFT]" wrote:
Hi Steve,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the whole xml document
as a string to a string object. If there is any misunderstanding, please
feel free to let me know.

In this case, we can use XmlDocument.OuterXml to get the whole document as
a string. Here's an example:

XmlDocument doc = new XmlDocument();
doc.Load(@"c:\a.xml");
this.textBox1.Text = doc.OuterXml;

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #3
Hi Steve,

I checked it on my computer, the OuterXml property still exists in
XmlDocument class in .net framework 2.0. Since .NET framework is backward
compatible, I don't think it will be moved to anywhere else. I'm currently
using Visual Studio .NET 2005 beta1.

If anything is unclear, please feel free to reply to this post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4

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

Similar topics

5
by: Alessandro | last post by:
Hi ! I have a big problem, i'm using XMLdocument to add elements to a XML file. Elements are like this: <name>Paolo</name> <comment>this is <a comment></comment> <description>In italian "is"...
4
by: James Geurts | last post by:
Hi all, I'm trying to convert a string representing a path to Dos 8.3 notation. The code that I have works fine if the path exists, but it will not work if the path does not exist. I am looking...
6
by: centrino | last post by:
hi, I import a funtion fromm dll file: dll function header : DWORD WINAPI Enumerate( HANDLE hWDMHandle, PNDIS_STATUS pNStatus,
5
by: Mika M | last post by:
Hi! I've made little code to convert string into hex string... Public ReadOnly Property ToHexString(ByVal text As String) As String Get Dim arrBytes As Integer() = CharsToBytes(text) Dim sb...
2
by: Thirsty Traveler | last post by:
How would I dynamcially create an XML document of the following form: <ReceiveTSSCallBack xmlns="http://LandAm.EAI.Mainframe.TSR"> <TSSCallBack...
4
by: James Page | last post by:
Hi all I have a shopping cart object which I'd like to send the contents via an e-mail. I get an error saying 'hybridDictionary' cannot be converted to string. Does anyone know how to do...
4
by: Jonathan Wood | last post by:
Does anyone know why the toBase argument in Convert.ToString() is limited to 2, 8, 10, or 16? It takes virtually the same code to support all base values from 2 to 36. And can anyone tell me if...
4
by: tshad | last post by:
I am trying to convert a string character to an int where the string is all numbers. I tried: int test; string stemp = "5"; test = Convert.ToInt32(stemp); But test is equal to 53.
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.