473,698 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 16247
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 misunderstandin g, please
feel free to let me know.

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

XmlDocument doc = new XmlDocument();
doc.Load(@"c:\a .xml");
this.textBox1.T ext = 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 misunderstandin g, please
feel free to let me know.

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

XmlDocument doc = new XmlDocument();
doc.Load(@"c:\a .xml");
this.textBox1.T ext = 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
26794
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" is = è !</description> the problem is that i want to encode text in name,comment and description.
4
9856
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 for a way to convert a string representing a long file path (whether or not it exists) to short (dos 8.3) form. This is what I have: private string GetShortPath(string longPath) { if (longPath.Length <= 8) { return longPath; } StringBuilder...
6
12879
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
37309
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 As StringBuilder = New StringBuilder For i As Integer = 0 To arrBytes.Length - 1
2
9122
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 xmlns="http://LandAm.EAI.Mainframe.TSR.Schemas.TSSCallback"> <orderNo xmlns="">string</orderNo> <customerId xmlns="">string</customerId> <taxingAuthorityList xmlns=""> <string>string</string> <string>string</string>
4
1923
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 this or point me in the right direction? Thanks
4
8181
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 the .NET library provides the means to convert a number to a string using base-36? Thanks. --
4
5078
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
10766
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 inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
8675
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
9160
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
8862
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
7729
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...
1
6521
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
5860
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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
2331
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.