Link to home
Start Free TrialLog in
Avatar of Borsec
BorsecFlag for Romania

asked on

problem with & in xml document

I have a problem while tried to deserialize a XML file that contains a special character '&'. The error message is “An error occurred while parsing EntityName. Line 14, position 40.”

public static CSettings ReadSettings()
{
    CSettings ob = null;
    xmlFile = Path.Combine(CDCPath.LocalSystemConfig, SETTINGS_FILE_NAME);
    if (System.IO.File.Exists(xmlFile))
    {              
        Stream stream = new FileStream(xmlFile, FileMode.Open, FileAccess.Read, FileShare.Read);
        System.Xml.XmlReader streamReader = System.Xml.XmlReader.Create(stream);
        System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer
                    (typeof(CSettings));
        ob = (CSettings)serializer.Deserialize(streamReader);
        stream.Close();
    }            
    return ob;
}

Open in new window

Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

can u post the xml?
ASKER CERTIFIED SOLUTION
Avatar of CyberSoft
CyberSoft
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
Avatar of Borsec

ASKER

Thanks! The problem is solved.
You're right, I found an simple '&'  in my XML file.
Great. Please mark this question as answered :)