Reputation: 19568
A semi colon character was expected. Error processing resource '...
<key>SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CNXT_MODEM_PCI_VEN_8086&DEV
How can I avoid this error being printed out when viewing my XML file in a browser? It seems to complain because of the '&' character, how do I escape it? thanks.
Upvotes: 5
Views: 10929
Reputation: 1
I had same issue and fixed it by using the following:
translate(replace(replace(TaskType),'&',' '),' > & < / \ " - ''',' ')
it removed all & and hyphen characters. I believe XML does not like those characters.
Upvotes: -1
Reputation: 161773
How did you create such XML? I bet you created it using string manipulation, as no self-respecting XML API would have produced such invalid XML.
This is why to create XML using XML APIs instead of string APIs.
var keyElement = new XElement(
"key", @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\CNXT_MODEM_PCI_VEN_8086&DEV");
Problem solved.
Upvotes: 3
Reputation: 272207
The & character should be escaped as &
, as per the XML standard. See this SO question for more info.
Upvotes: 4
Reputation:
You need to use the character entity &
You will also probably experience issues with the open angle bracket, which needs to be encoded as <
Upvotes: 3