I have got the following exception from the below code block.
An error occurred while parsing EntityName. Line1, position 844.
I was trying
As the data comes from some data base, the problem can be hot-fixed in the context you described, but I would strongly recommend a different approach. The ampersand symbol should not have occured in the xml in the first place, as discussed here. Please clarify how the xml is generated and address the problem there.