473,407 Members | 2,598 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,407 software developers and data experts.

Why xml being excaped in xmldocument?

Hello, I have a file:

test.txt:
<?xml version="1.0" encoding="UTF-8"?>
<First>
<value>3</value>
</First>

I am reading it like this:

XmlDocument xml = new XmlDocument();
xml.Load("test.txt")

If I do an xml.OuterXml, I get
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<First>
<value>3</value>
</First>

How do I get rid of the "\" character?

Thanks in advance.

Adam Smith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
2 1503
That's not really in there (if you open the document in Notepad you'll see),
it's just a visual effect of the method you are using to display the XML
string (eg. same as output to the debug window in Visual Interdev for
JavaScript strings). The '\' is short for 'the next character is usually a
special character in my string representation so I'll escape it in the
output as a visual aid'.

Chris.

"Adam Smith" <ad*********@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
Hello, I have a file:

test.txt:
<?xml version="1.0" encoding="UTF-8"?>
<First>
<value>3</value>
</First>

I am reading it like this:

XmlDocument xml = new XmlDocument();
xml.Load("test.txt")

If I do an xml.OuterXml, I get
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<First>
<value>3</value>
</First>

How do I get rid of the "\" character?

Thanks in advance.

Adam Smith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2
Yup... this will be fixed in Whidbey AFAIK

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:Ob**************@tk2msftngp13.phx.gbl...
That's not really in there (if you open the document in Notepad you'll see), it's just a visual effect of the method you are using to display the XML
string (eg. same as output to the debug window in Visual Interdev for
JavaScript strings). The '\' is short for 'the next character is usually a
special character in my string representation so I'll escape it in the
output as a visual aid'.

Chris.

"Adam Smith" <ad*********@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
Hello, I have a file:

test.txt:
<?xml version="1.0" encoding="UTF-8"?>
<First>
<value>3</value>
</First>

I am reading it like this:

XmlDocument xml = new XmlDocument();
xml.Load("test.txt")

If I do an xml.OuterXml, I get
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<First>
<value>3</value>
</First>

How do I get rid of the "\" character?

Thanks in advance.

Adam Smith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004
Nov 12 '05 #3

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

Similar topics

1
by: Martin Honnen | last post by:
With both .NET 1.0 and 1.1 I have found the following strange behaviour where System.Xml.XmlDocument.LoadXml doesn't throw an error when parsing a text node with a character reference to an invalid...
4
by: Robert Rossney | last post by:
I'm trying to send and receive XmlDocument objects using the System.Messaging.dll functions. The code I've written follows, as best I can tell, the methodology used in the sample code for the...
2
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public...
2
by: Dave | last post by:
Hi, Is there an easier way to pull a subset of nodes from one XmlDocument to another? I have the code below but would like to know if there is a more streamlined method. Thanks, Dave ...
8
by: pete | last post by:
Hi there, Can someone explain to me why I can't bind to an XmlDocument but I can bind to an XmlNodeList. It's my understanding that they both implement the IEnumerable interface which is...
1
by: Peter Nofelt | last post by:
Hey All, I'm running into this issue with parsing through an xml document by tag name. Below is an example xml document: File Name: things.xml <things> <people> <name>Peter</name>
1
by: David | last post by:
I need to find a good online resource which teaches the use of the XmlDocument framework in more depth than is covered in MS's online doc. I need to create a multi-level XML document like the one...
5
by: Rob Panosh | last post by:
Hello, I am trying to create a xmlDocument from as dataset. My code is listed below. All seems to go well until xmlDocument.Load(CType(ms, System.IO.Stream)) ... I keep getting the following...
2
by: John Smith | last post by:
I'm writing webervice client using .Net 2.0. I have this class: public class MyWebService : SoapHttpClientProtocol { public XmlDocument validate(string url, XmlDocument xmlDocument) {...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.