Is there a way to prevent .NET's XmlReader
class from expanding XML entities into their value when reading the content?
For instance, suppose the following XML is used as input:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE author PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML" "http://www.oasis-open.org/docbook/xmlcharent/0.3/iso-lat1.ent" >
<author>á</author>
Let's assume it is not possible to reach the external OASIS DTD needed for the expansion of the aacute entity. I would like the reader to read, in sequence, the author element, then the aacute node of type EntityReference
, and finally the author end element, without throwing any errors. How can I achieve this?
UPDATE: I also want to prevent the expansion of character entities such as á
.