Ampersands causes issue

May 15, 2014 at 8:41 PM
Edited May 15, 2014 at 8:43 PM
hello,
Great web part, thanks for putting it together. I noticed that having any '&' in a dropdown list caused the crash below. We have some job titles with those. But having
&
worked fine. So mine is working now after replacing them. But curious if the code can be updated to handle the '&'.

Thanks so much,
Chris


System.Xml.XmlException: An error occurred while parsing EntityName. Line 1, position 1668. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseEntityName() at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at ADUserEditorWebpart.ADUserEditorWebpart.Utilities.getUserPropertiesFromXML(String XML) at ADUserEditorWebpart.ADUserEditorWebpart.ADUserEditorWebpart.CreateChildControls()
Coordinator
May 28, 2014 at 4:59 PM
Thanks for pointing this, and posting the solution which may be useful for the others users.

There's nothing I can do on my side to improve this, as this is the way XML language works, trying to interpret everything with an '&' character as an entity and crashing if it's not....

So replacing it with '&' is the way to go :)