Reputation: 2892
I have an & character in one of the xml nodes as below.
<dependents>9 & 5</dependents>
When I try to load the file as below, it is giving an error "An error occured while parsing EntityName.". Is it possible to escape this character and load successfully? Thank you.
m_InputXMLDoc = new XmlDocument();
if (System.IO.File.Exists(InputFile))
{
m_InputXMLDoc.Load(InputFile);
}
Upvotes: 1
Views: 150
Reputation: 7539
Use a CDATA section
<dependents><![CDATA[9 & 5]]></dependents>
Upvotes: 6