I want to use & character but the Visual Studio throw exception. How Have to write this?
5 Answers
There are two ways to represent characters which have special meaning in XML (such as < and >) in an XML document.
- CDATA sections
- As entities
A CDATA section can only be used in places where you could have a text node.
<foo><![CDATA[Here is some data including < and > (and &!) ]]></foo>
The caveat is that you can't include the sequence ]]> as data in a CDATA section.
Entities can be used everywhere (except inside CDATA sections) and consist of &, then an identifier, then ;.
<foo>Here is some data including < and > (and &!)</foo>