EntityReference Reading and Expansion
The capability of expanding character and entity references when reading XML data, and have the resulting expanded text returned, depends on the type of XmlReader used to read the data.
The XmlValidatingReader has an EntityHandling Property enumeration of ExpandEntities or ExpandCharEntities, with the default setting of ExpandEntities. A value of ExpandEntities expands both character and entity references. A value of ExpandCharEntities expands only character references, but returns entity references as general nodes and requires a call to ResolveEntity to get its expanded content.
The XmlNodeReader has a ResolveEntity method that must be called to expand the references. The XmlTextReader cannot resolve entities. Calling ResolveEntity on XmlTextReader will throw an exception. To determine the ability of certain XmlReaders to resolve entities, see the XmlReader.CanResolveEntity property.
Reading XML with the XmlReader | Current Node Position in XmlReader | Property Settings on XmlReader | Object Comparison Using XmlNameTable with XmlReader | Reading Attributes with XmlReader | Reading Element and Attributes Content | Skipping Content with XmlReader | Comparing XmlReader to SAX Reader | Reading XML Data with XmlTextReader | Reading Node Trees with XmlNodeReader | Validating XML with XmlValidatingReader | Customized XML Reader Creation | XmlReader Class | XmlReader Members | XmlNodeReader Class | XmlNodeReader Members | XmlTextReader Class | XmlTextReader Members | XmlValidatingReader Class | XmlValidatingReader | XmlValidatingReader.EntityHandling | XmlReader.ResolveEntity