Hi,
I'm trying to validate an xml document against a schema. I get an
exception saying "For security reasons DTD is prohibited in this XML
document. To enable DTD processing set the ProhibitDtd property on
XmlReaderSettin gs to false and pass the settings into XmlReader.Creat e
method.", however I have set it to false so not sure what else to try.
Here's my code:
FileStream fs = File.Open(myFil ePath, FileMode.Open);
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Prohib itDtd = false;
settings.Schema s.Add(null, "http://www.w3.org/TR/xmldsig-core/xmldsig-
core-schema.xsd");
settings.Valida tionType = ValidationType. Schema;
settings.Valida tionEventHandle r += new
System.Xml.Sche ma.ValidationEv entHandler(sett ings_Validation EventHandler);
XmlReader reader = XmlReader.Creat e(fs, settings);
while (reader.Read())
Am I missing something obvious?
Many thanks,
AK
I'm trying to validate an xml document against a schema. I get an
exception saying "For security reasons DTD is prohibited in this XML
document. To enable DTD processing set the ProhibitDtd property on
XmlReaderSettin gs to false and pass the settings into XmlReader.Creat e
method.", however I have set it to false so not sure what else to try.
Here's my code:
FileStream fs = File.Open(myFil ePath, FileMode.Open);
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Prohib itDtd = false;
settings.Schema s.Add(null, "http://www.w3.org/TR/xmldsig-core/xmldsig-
core-schema.xsd");
settings.Valida tionType = ValidationType. Schema;
settings.Valida tionEventHandle r += new
System.Xml.Sche ma.ValidationEv entHandler(sett ings_Validation EventHandler);
XmlReader reader = XmlReader.Creat e(fs, settings);
while (reader.Read())
Am I missing something obvious?
Many thanks,
AK
Comment