Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

How to insert string with "<" and ">"??

I trie to insert a string (sTest) with "<" and ">" to a node with follwing Code:
InnerNode.InnerText = sTest
But when I view the XML document, the "<" and ">" were coverted to "<" and ">". I need to preserve the "<" and ">" . Any help is appreciated.
[297 byte] By [JFeng] at [2007-11-11 8:47:51]
# 1 Re: How to insert string with "<" and ">"??
Bear in mind that when an XML parser reads the text node you've created, < and > will be presented to you as '<' and '>'.

If you absolutely need to keep the '<' and '>', use a CDATA section:

<![CDATA[now I can use as many <s and >s as I like]]>
geralds at 2007-11-11 23:28:38 >