0

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

John Saunders
  • 160,644
  • 26
  • 247
  • 397
0xFF
  • 4,140
  • 7
  • 41
  • 58

2 Answers2

0

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.
  • 7,018
  • 2
  • 32
  • 54
0

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
  • 75,175
  • 8
  • 100
  • 122