Resolving entities when loading XmlDocument

Recently I needed to place special characters in an xml document.  I had to put the &trade and &reg into the text of an attribute.  When I loaded the xml into XmlDocument, I received an exception:

Reference to undeclared entity

To solve this I added the following to the top of my xml file:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE documentElement [
 <!ENTITY reg "®">
 <!ENTITY trade "™">
]>

This allowed for the parsing of the document, since now the entities were declared...

1 Comment

Comments have been disabled for this content.