How can I validate the output of XmlSerializer?

Posted by Tim Jansen on Stack Overflow See other posts from Stack Overflow or by Tim Jansen
Published on 2010-03-09T09:37:06Z Indexed on 2010/03/09 9:51 UTC
Read the original article Hit count: 611

In C# / .NET 2.0, when I serialize an object using XmlSerializer, what's the easiest way to validate the output against an XML schema?

The problem is that it is all too easy to write invalid XML with the XmlSerializer, and I can't find a way to validate the XML that does not look cumbersome. Ideally I would expect to set the schema in the XmlSerializer or to have a XmlWriter that validates.

© Stack Overflow or respective owner

Related posts about c#

Related posts about xmlserializer