this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Tuesday, March 29, 2011

Allowing special character in xml with .net in built class

Recently I was finding solution to allowing special character in xml, it can be done by replacing with replaced code. You can check here

But if you are using .net then we have one inbuilt class that replaces all of the special character with replaced code and you don’t need to worry for every special character replacement.

Code sample:

XMLstring = System.Security.SecurityElement.Escape(XMLstring)

Monday, March 21, 2011

Allow special character in XML

XML is very useful in any of the programming language. You have many controls of your data representation. One of the features of platform independent makes vital use of it.

In actual data we have different characters which are not supported in XML if we directly write in it. Here are some lists which can be used to replace actual character in XML.

Less than < can be replaced with &lt

Greater than > can be replaced with &gt

Ampersand & can be replaced with &amp

Quotation "can be replaced with &quot

Apostrophe ' can be replaced with &apos

At the end of replaced character we should keep one ;

Hope this list is useful when we want to use special character in XML.