there is a much easy way to do it:
private void ValidationCallBack(object sender, ValidationEventArgs e)
{
throw new Exception();
}
public bool validate(string sxml)
{
try
{
XmlDocument xmld=new XmlDocument ();
xmld.LoadXml(sxml);
xmld.Schemas.Add(null,@"c:he file location");
xmld.validate(ValidationCallBack);
return true;
}
catch
{
return false;
}
}
P.S : I didn't wrote this in VS so there might be word that not in case sensitive, but this codes works!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…