I want to validate xml documetn aganst xsd schema, the validation seems not validating the document when its loaded from url.
have tried to validate a xml document that is located on local disk and it went well but not when im loading xml from url How can i validate it ? Im sure that the xml is loaded to xDoxument. here my code
XmlSchemaSet scehma = new XmlSchemaSet();
scehma.Add("", @"C:\MySchema.xsd");
XDocument xmlDocument = XDocument.Load(urlString, LoadOptions.PreserveWhitespace);
xmlDocument.Validate(scehma, (s, e) =>
{
Console.Write(e.Message);
isValidated = true;
});
No comments:
Post a Comment