C# XmlSchema.Read无法正确加载xsd
我尝试使用XmlSchema.Read加载xsd文件。它运行时没有错误,我可以看到它从文件中读取名称空间,但我无法从xsd文件中读取任何其他数据 这是我的密码:C# XmlSchema.Read无法正确加载xsd,c#,xsd,C#,Xsd,我尝试使用XmlSchema.Read加载xsd文件。它运行时没有错误,我可以看到它从文件中读取名称空间,但我无法从xsd文件中读取任何其他数据 这是我的密码: public XmlSchema GetXSDFileAsXMLSchema() { FileStream fs = new FileStream(path, FileMode.Open); XmlSchema schema = XmlSchema.Read(fs, new ValidationE
public XmlSchema GetXSDFileAsXMLSchema()
{
FileStream fs = new FileStream(path, FileMode.Open);
XmlSchema schema = XmlSchema.Read(fs, new ValidationEventHandler(ValidationCallBack));
return schema;
}
private void ValidationCallBack(object sender, ValidationEventArgs args)
{
return;
}
有人知道为什么元素的计数为0吗?MSDN说,只有在调用Compile()之后,元素才会被填充。在此之前,您可以使用模式的原始元素,如Items。MSDN说,元素只有在调用Compile()后才能填充。在此之前,您可以使用模式的原始元素,如Items。此外,他应该使用
块将FileStream
放入中。该方法已被弃用。此外,他应该将FileStream
放入using
块中。这些方法已被弃用。