I am experimenting with using VB.Net's Xml Literals as a templating system for generating HTML. What I am wondering if there is any way to control the escaping. For example if I have code similar to the following
Dim param1Value as String = "test"
Dim html = <div>
<a id="myLink" href="<%= "/mysite/myfile?param1=" + param1Value + "¶m2=test2" %>"
</div>
This will produce a link with the ampersands xml encoded (&
). Currently, I am just un-escaping these when transforming the xmlElement to a string. I am assuming that is my only option as anything else produces invalid XML, but I was wondering if there was any way to specify that an XML Literal is a raw value and does not need Xml Escaped.