Can SL 3 do validation of an XML document against a DTD file? RRS feed

  • Question

  •  I know SL 3 does not support validation against an XML Schema, but it should support validation against DTD (from what I've seen). However, I have not been successful w/ it.

    I use a XmlReaderSettings object to set the DtdProcessing property to DtdProcessing.Parse. The DTD file gets located successfully and loaded. I know that because if the file is not well-formed (syntactically incorrect), then I get an XmlException when it is read. So the loading of the file is NOT the problem. The issue is that the XML file never gets validated against the DTD file. For instance, if there is a missing attribute (required in the DTD file) or an element, which is out of place in the XML file, I never get notified of that.

    I see that in the full .NET framework there is an XmlValidatingReader, which has an event you can handle, which gets called if an element in the XML file does not match the DTD. I see no such event in the Silverlight .NET framework.

    So my question is, does SL 3 actually support validation against a DTD and if yes, how do you know when a validation error occurs?

    Thanks very much for your time!

    Friday, December 11, 2009 11:00 AM