I'm looking at what the xml resolver System.Xml.Resolvers.XmlPreloadedResolver
brings to the table in terms of dtds and i'm stumped by the fact that the entity <
is recognized by the xml reader but not the entity é
.
private static void Main(string[] args)
{
string invalidContent = "<?xml version=\"1.0\" encoding=\"utf-8\"?><key value=\"char é invalid\"/>";
string validContent = "<?xml version=\"1.0\" encoding=\"utf-8\"?><key value=\"char < valid\"/>";
XmlDocument xmlDocument = new XmlDocument();
var xmlReaderSettings = new XmlReaderSettings()
{
DtdProcessing = DtdProcessing.Parse,
XmlResolver = new XmlPreloadedResolver(XmlKnownDtds.All),
ProhibitDtd = false
};
using (XmlReader reader = XmlReader.Create(new StringReader(invalidContent), xmlReaderSettings))
{
xmlDocument.Load(reader); // reference to undeclared entity 'eacute'
}
using (XmlReader reader = XmlReader.Create(new StringReader(validContent), xmlReaderSettings))
{
xmlDocument.Load(reader); //
}
}
Checking inside the XmlPreloadedResolver i can see that the XmlKnownDtds.All
should bring in the xhtml-lat1.ent file which contains the eacute entity, along with many others. Any idea why i'm seeing this behavior?