Validating XML Via Embedded XSD Schema
Problem
You have some XML, and you need to validate it against a custom schema that you want to deploy with your .Net 2.0 assemblies. Issues addressed: opening the file and handling the schema validation.
Solution
The XmlSchema class contains a
Read
method that takes a stream as a parameter. Nicely matching up to that, you can
open a stream from an embedded resource (dead link removed; SF 2025).So, embed
the schema. In Visual Studio's Solution Explorer, right-click the schema file
and choose properties. Change the Build Action to "Embedded Resource".

