• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

Using xml in my c# application

Hi,

I have this:

            "<Node Id=" + "3" + " ParentId=" + "1" + ">" + "\r\n" +
 
I use this line above to display it in a textbox.
Only I need to display the " too
(I don't know how you call " in english)
So it has to be something like this:

""3"" but with this I get an error.

How can i display the "-sing in my textbox.

I hope I have explain this right. My English isn't very well.

Peter
0
peterkiers
Asked:
peterkiers
  • 4
  • 4
1 Solution
 
strickddCommented:
&quot; instead of the " to escape it in XML
0
 
peterkiersAuthor Commented:
Don't understand what you mean. Can you give me an example

Peter
0
 
strickddCommented:
"&quot;3&quot;"
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
peterkiersAuthor Commented:
??? when i do that i get displayed in the textbox:



<Node Id=&quot;3&quot; ParentId=1>

and it should be

<Node Id="3" + ParentId="1">
0
 
Ariful AmbiaHead of ITCommented:

const char doubleQuote = '"';

Console.WriteLine("<controls:FormField Name={0}Strasse{0} LabelText={0}Strasse{0}>", doubleQuote);
0
 
peterkiersAuthor Commented:
With this I get an error:
"<Node Id=" + ""3"" <================
0
 
strickddCommented:
so when you write it to the textbox, either do a .Replace("&quot;", "\"") or HTMLEncode(myXML)
0
 
peterkiersAuthor Commented:
This works for me:

"<Node Id=" + doubleQuote + 3 + doubleQuote  etc...

Thanks.

500 points goes to NomanBD

Greetings,

Peter Kiers
0
 
strickddCommented:
Please review this: http://www.hdfgroup.org/HDF5/XML/xml_escape_chars.htm

Note the escape characters. To put these in XML, you have to escape them as specified and then un-escape them when you use them.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now