Xml ProhibitDtd error

A

agda.karlberg

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
XmlReaderSettings to false and pass the settings into XmlReader.Create
method.", however I have set it to false so not sure what else to try.

Here's my code:

FileStream fs = File.Open(myFilePath, FileMode.Open);

XmlReaderSettings settings = new XmlReaderSettings();

settings.ProhibitDtd = false;
settings.Schemas.Add(null, "http://www.w3.org/TR/xmldsig-core/xmldsig-
core-schema.xsd");

settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler += new
System.Xml.Schema.ValidationEventHandler(settings_ValidationEventHandler);

XmlReader reader = XmlReader.Create(fs, settings);

while (reader.Read())

Am I missing something obvious?

Many thanks,

AK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top