Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Reading a xml tag containing ONE backslash but I get TWO backslash back?

Posted on 2009-04-30
3
Medium Priority
?
543 Views
Last Modified: 2012-05-06
Hello,

I have a xml problem:

         this is part of my xml file:

            <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
            <trennzeichen>\t</trennzeichen>

I want to read the tag "trennzeichen" with that method:      

str_Delimiter = xn_Portal.SelectSingleNode("trennzeichen").InnerText;

the result of str_Delimiter is "\\t"

why do I have TWO of those backslashes ? I write those data in a .txt file and for sure there are those TWO backslashes, but why?
0
Comment
Question by:MSFanboy
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
strickdd earned 2000 total points
ID: 24273057
In c#, the "\" has to be escaped by a "\". That means when you want a string to be:

C:\Program Files

you actually need to do this:

string myString = "C:\\Program Files"

When you output the string, you should only get one slash.
0
 

Author Comment

by:MSFanboy
ID: 24292809
when I put \\t in the XML-tag I get FOUR "\\\\" not what I wanted.
0
 

Author Comment

by:MSFanboy
ID: 24292814
ok the above error is only in debuging mode but in the .txt its written properly!!! thx
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month21 days, 5 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question