根据xsd文件中的模式,尝试了解xml文件是否有效时,C#中出现错误

根据xsd文件中的模式,尝试了解xml文件是否有效时,C#中出现错误,c#,xml,validation,xsd,schema,C#,Xml,Validation,Xsd,Schema,根据xml文件在xsd文件中的模式,我试图知道xml文件是否有效时遇到了一个问题 它给了我一个xsd文件中的错误 上面说“通配符”##any“允许元素“”,并导致内容模型变得不明确。内容模型的形成必须确保在元素信息项序列的验证期间,直接、间接或隐式包含在其中的粒子可以在不检查该项的内容或属性的情况下唯一地确定,从而尝试依次验证序列中的每个项,而且没有关于序列剩余部分中项目的任何信息。” 这是我的密码: try { XmlReaderSettings Xse

根据xml文件在xsd文件中的模式,我试图知道xml文件是否有效时遇到了一个问题

它给了我一个xsd文件中的错误

上面说“通配符”##any“允许元素“”,并导致内容模型变得不明确。内容模型的形成必须确保在元素信息项序列的验证期间,直接、间接或隐式包含在其中的粒子可以在不检查该项的内容或属性的情况下唯一地确定,从而尝试依次验证序列中的每个项,而且没有关于序列剩余部分中项目的任何信息。”

这是我的密码:

try
        {
            XmlReaderSettings Xsettings = new XmlReaderSettings();
            Xsettings.ValidationType = ValidationType.Schema;

            openFileDialog1.Title = "The address of the xsd file";
            openFileDialog1.Filter = "xsd files|*.xsd";
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName == "")
            {
                MessageBox.Show("Operation was cancelled.");
            }
            else
            {
                Xsettings.Schemas.Add(null, openFileDialog1.FileName);

                openFileDialog1.FileName = "";
                openFileDialog1.Title = "The address of the xml file";
                openFileDialog1.Filter = "xml files|*.xml";
                openFileDialog1.ShowDialog();

                if (openFileDialog1.FileName == "")
                {
                    MessageBox.Show("Operation was cancelled.");
                }
                else
                {
                    XmlDocument document = new XmlDocument();
                    document.Load(openFileDialog1.FileName);

                    XmlReader reader = XmlReader.Create(new StringReader(document.InnerXml), Xsettings);

                    while (reader.Read()) ;
                    MessageBox.Show("Validation was successful.");
                }
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show("The XML file is not valid.\n" + ex.Message);
        }
我的代码中有缺陷吗


请帮助…

在哪一行出现此错误?XmlReader=XmlReader.Create(new-StringReader(document.InnerXml),Xsettings);