针对XSD文件的XML验证

针对XSD文件的XML验证,xml,xsd-validation,Xml,Xsd Validation,我想根据XSD文件验证我的xml文件,XSD文件的attributeGroup如下所示 我无法使用以下方法验证相同的内容: XmlTextReader file = new XmlTextReader("xsdFilePath"); schemas.Add("", file); XDocument xmlDoc = XDocument.Load("xmlFilePath"); xmlDoc.Validate(schemas, (o, e) => { valdiationMessa

我想根据XSD文件验证我的xml文件,XSD文件的attributeGroup如下所示

我无法使用以下方法验证相同的内容:

XmlTextReader file = new XmlTextReader("xsdFilePath");
schemas.Add("", file);

XDocument xmlDoc = XDocument.Load("xmlFilePath");
xmlDoc.Validate(schemas, (o, e) =>
{
    valdiationMessages.Add(e.Message);
}, true);
return valdiationMessages;
问候,, 基肖尔M