gpt4 book ai didi

c# - XmlSchema.Read 没有正确加载 xsd

转载 作者:太空宇宙 更新时间:2023-11-03 22:17:28 26 4
gpt4 key购买 nike

我正在尝试使用 XmlSchema.Read 加载 xsd 文件。它运行没有错误,我可以看到它从文件中读取命名空间,但我无法从 xsd 文件中读取任何其他数据。

这是我的代码:

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。

关于c# - XmlSchema.Read 没有正确加载 xsd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4547457/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com