I'm trying to validate an XML feed against the ONIX 2.1 dtd. When I load the generated XML file into XMLSpy and validate against the DTD, it tells me that the feed is valid.
When I try to validate the same file using C# and XmlReader, I receive errors that child nodes are invalid despite being validated earlier by the 3rd party tool. What do I need to do in order to ensure that my code using XmlReader is correctly reading the dtd and validating appropriately?
Here's my code...
XmlReaderSettings settings = new XmlReaderSettings();
settings.ProhibitDtd = false;
settings.ValidationType = ValidationType.DTD;
settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings;
settings.ValidationEventHandler += new ValidationEventHandler(delegate(object sender, ValidationEventArgs args)
{
isXmlValid = false;
xmlValMsg.AppendLine(args.Message);
});