Link to home
Start Free TrialLog in
Avatar of ipjyo
ipjyoFlag for United States of America

asked on

Is it possible to escape & while loading xml?

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 yu.

m_InputXMLDoc = new XmlDocument();
            if (System.IO.File.Exists(InputFile))
            {
                m_InputXMLDoc.Load(InputFile);
            }

SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ipjyo

ASKER

Thank you very much. I will try this. I may not be able to replace with XDocument since it involves too many code changes.

Thanks again.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ipjyo

ASKER

Cool. Thanks for your help.