Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Last active April 20, 2024 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wullemsb/a6c61f4304c02f52e809bfbd4dfe6d17 to your computer and use it in GitHub Desktop.
Save wullemsb/a6c61f4304c02f52e809bfbd4dfe6d17 to your computer and use it in GitHub Desktop.
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.ValidationType = ValidationType.Schema;
xmlReaderSettings.Schemas.Add(schema);
//Add this line
xmlReaderSettings.DtdProcessing=DtdProcessing.Prohibit;
var xmlTextReader = new XmlTextReader(new StreamReader(new MemoryStream(xmlData)));
var xmlReader = XmlReader.Create(xmlTextReader, xmlReaderSettings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment