The following minimal test case throws an error in powershell:
[reflection.assembly]::LoadWithPartialName('system.xml.linq')
[system.xml.linq.xdocument]::parse('<node>&</node>')
and frankly, in any .net library. This is a real problem when storing urls – for examaple if the content of <node> was http://test.com/?one=a&two=b.
How should it be properly encoded?
An encoded ampersand in XML is
&Running it with the encoded ampersand will not throw an exception: