Reference to undeclared entity exception while working with XML

Try replacing &Alpha with

  Α

XML, unlike HTML does not define entities (ie named references to UNICODE characters) so α — etc. are not translated to their corresponding character. You must use the numerical value instead. You can only use < and & in XML

If you want to create HTML, use an HtmlDocument instead.


In .Net, you can use the System.Xml.XmlConvert class:

string text = XmlConvert.EncodeName("Hello α");

Alternatively, you can declare the entities locally by putting the declarations between square brackets in a DOCTYPE declaration. Add the following header to your xml:

<!DOCTYPE documentElement[
<!ENTITY Alpha "&#913;">
<!ENTITY ndash "&#8211;">
<!ENTITY mdash "&#8212;">
]>

Do a google on "html character entities" for the entity definitions.

Tags:

C#

Xml

Dtd