views:

38

answers:

0

My XmlReader instance created by factory method XmlReader.Create(..) is including entity references along with surrounding text into one complete blurb of type XmlNodeType.Text (It's actually unescaping the entities into the text).

For example if the XML source contains <div>this &amp; that</div>

XmlReader will parse out

readerInstance.Value == "this & that";  //Text

versus...

When I create an XmlNodeReader instance, it will parse out the entity references each as XmlNodeType.EntityReference type, distinct from text portions.

XmlNodeReader with the same source parses out

nodeReaderInstance.Value == "this "; // Text
nodeReaderInstance.Name  == "amp";  // EntityReference << This is what I want.
nodeReaderInstance.Value == " that" // Text

Can I make my XmlReader instance parse out entity references just as XmlNodeReader does?


Updates to Question:

  • reader.CanResolveEntity returns true on my instance.
  • My instance created by XmlReader.Create(..) is of Type XmlTextReaderImpl.
  • I might be a victim of my own circumstance because I've been swapping around DTD, Schemas, system entity mappings and many kinds of XML-ish things in the document...