Skip to content

Instantly share code, notes, and snippets.

@udooz
Created November 20, 2012 23:34
Show Gist options
  • Save udooz/4122011 to your computer and use it in GitHub Desktop.
Save udooz/4122011 to your computer and use it in GitHub Desktop.
System.Xml
System.Xml.Schema
System.IO
XmlSchemaSet schemas = new XmlSchemaSet();
schemas.Add("http://tempuri.org/XMLSchema.xsd", @"SchedulerJob.xsd");
XDocument doc = XDocument.Load(@"restoretable.xml");
string msg = "";
doc.Validate(schemas, (o, e) => {
msg = e.Message;
});
Console.WriteLine(msg == "" ? "Document is valid" : "Document invalid: " + msg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment