XMLReader crashing on &

The XML I am getting back on occasion has an & in it, like “Honolulu High & Intermediate School”. When it getss to the ampersand it throws an XmlReaderException error. I can trace it down to the element where characters gets “Honolulu High” then it crashes when it exits characters.

I have no control over the incoming XML which I am downloading from a remote server usint HTTPSocket. I did some experimenting with my own xml. I set it up so that the remote server changed the & to “&” so that “Honolulu High & Intermediate School” was sent in the response. The XMLReader did not crash but characters only parsed “Honolulu High” for the school nae. The ampersand and the remainder of the field gets cut off.

I also tried “&”.

Should I be doing something else with the xml before I send it to be parsed?

The XML is invalid if it contains & instead of &
At best you might use a regex to check the contents of any nodes & replace any items that MUST be replaced with proper entities (there’s a handful)