title: How do I validate an XML document against a DTD in C#?
body: <p>I don't want to do anything fancy, I just want to make sure a document is valid, and print an error message if it is not. Google pointed me to <a href="http://support.microsoft.com/kb/307379" rel="nofollow noreferrer">this</a>, but it seems XmlValidatingReader is obsolete (at least, that's what MonoDevelop tells me).</p>
  
  <p>Edit: I'm trying Mehrdad's tip, but I'm having trouble. I think I've got most of it, but I can't find OnValidationEvent anywhere. Where go I get OnValidationEvent from?</p>
  
  <pre><code>XmlReaderSettings settings = new XmlReaderSettings();
  settings.ValidationType = ValidationType.DTD;
  settings.ValidationEventHandler += new ValidationEventHandler(/*trouble is here*/);
  XmlReader validatingReader = XmlReader.Create(fileToLoad, settings);
  </code></pre>