XElement xmldata = XElement.Load(@"Ad.xml"); XDocument acordRequestxml = XDocument.Parse(xmldata.ToString()); XmlSchemaSet schemaSet = new XmlSchemaSet(); schemaSet.Add("", @"Schema.xsd"); acordRequestxml.Validate(schemaSet, (sender, e) => { if (sender is XObject) { XElement dat = (XElement)sender; Console.WriteLine(e.Severity); switch (e.Severity) { case XmlSeverityType.Error: Console.WriteLine(MessageFormat(e.Message) + "\n" + "XPATH : " + GetPath(dat) + "\n"); break; case XmlSeverityType.Warning: Console.WriteLine(MessageFormat(e.Message) + "\n" + "XPATH : " + GetPath(dat) + "\n"); break; } } });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)