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

Escape characters in InnerXml

XmlDocument oXmlDoc = new XmlDocument();
oXmlDoc.Load(filename);
node = oXmlDoc.SelectSingleNode("//config/ldap/userpath");
Console.Write(node.InnerXml);

The value I get is:

\r\n\t\t\tOU=Walshy,OU=GroupServices,OU=organizati ons,OU=Portal,DC=portaladdev,DC=intranet,DC=local\ r\n\t\t

I know this is because of the format of the xml doc. The question is,
how do I get the value from the element without the escape characters?

Example of xml doc is as follows:

<?xml version="1.0" encoding="UTF-8" ?>
<config>
<ldap>
<userpath>
OU=Walshy,OU=GroupServices,OU=organizations,OU=Por tal,DC=portaladdev,DC=intranet,DC=local
</userpath>
</ldap>
</config>

Thanks.
Nov 16 '05 #1
1 3702
Ian Walsh <sp*******@tiscali.co.uk> wrote:
XmlDocument oXmlDoc = new XmlDocument();
oXmlDoc.Load(filename);
node = oXmlDoc.SelectSingleNode("//config/ldap/userpath");
Console.Write(node.InnerXml);

The value I get is:

\r\n\t\t\tOU=Walshy,OU=GroupServices,OU=organizati ons,OU=Portal,DC=po
rtaladdev,DC=intranet,DC=local\r\n\t\t
My guess is that you're looking in the debugger.
I know this is because of the format of the xml doc. The question is,
how do I get the value from the element without the escape characters?


The escape characters aren't actually there - the actual tabs, carriage
returns etc are there though. If you don't want them, use String.Trim.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

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

Similar topics

2
by: BTnews | last post by:
Hi, Can anyone here point me at a definitive guide or tutorial about using escape characters when building SQL queries from user entered data? I'm especially interested in info on this in regard...
5
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
3
by: Guadala Harry | last post by:
I'd like to know the answer to the following question so I can know what to expect with regard to other similar uses of escape characters and strings. While everything works fine - I'd like to know...
4
by: needin4mation | last post by:
Hi, string filename = "Directions2.xml"; XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("Directions2.xml")); XmlElement root = doc.DocumentElement; XmlNode oldLoc; oldLoc =...
15
by: pkaeowic | last post by:
I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN....
131
by: Lawrence D'Oliveiro | last post by:
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if...
2
by: Richard Lewis Haggard | last post by:
Is it possible to use features from XmlDocument to unescape text back to its original raw text format after it has been escaped to handle non-HTML compliant character strings? I have code that...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.