views:

1062

answers:

2

tryin to parse an xml file gives me the following error Reference to undeclared entity 'eacute'

after I created a dtd file with all the entities that I found here http://www.w3.org/TR/xhtml1/dtds.html and I loaded it as follows

XmlReaderSettings settings = new XmlReaderSettings();
settings.ProhibitDtd = false;
string s = System.IO.File.ReadAllText(@"..\xhtml-lat1.ent");
XmlParserContext con = new XmlParserContext(null, null, "iti", null, null, s, "", "", XmlSpace.None);
XmlReader reader = XmlReader.Create(stream, settings, con);

the loading an xdocument

XDocument doc = XDocument.Load(reader);

give me the following exception '=' is an unexpected token. The expected token is ';'.

any suggestions please

A: 

Generally, this error happens when the xml document is not well-formed.

One tip to find the error, open your xml document in Internet Explorer. If the xml document is not well-formed, Internet Explorer will not be able to load the entire document and will tell you where the error is located.

Francis B.
yes internet explorer is giving the same error
martani_net
A: 

If I recall correctly, the only place a semicolon matters in XML is in an entity encoding. I would check for an incomplete entity (maybe &eacute) or a special character in the document that should be encoded.

dahlbyk