Say I have the following XML:
<someRootElement>
<someTagWithUrl>http://www.google.com/s.php&test=testing</someTagWithUrl>
</someRootElement>
The ampersand inside someTagWithUrl is invalid and should be escaped (with &), but suppose I have one line with all the contents above.
How can I safely avoid ampersand so that it becomes valid XML? Can the .NET XML library ignore this? (XElement.Parse is currently throwing an exception)
I was thinking about using a regular expression to search for ampersands between tags, but I cannot get the correct syntax. (something like> (\ &) \ <as a regular expression replaces usage, but I can't figure it out).
source
share