0
votes

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

2

2 Answers

0
votes

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.

0
votes

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.