“use”属性在此上下文中不受支持。C#

3
我正在尝试使用C#中的ReadXmlSchema读取xsd文件,但在尝试读取xsd文件时遇到了问题。我收到了以下错误消息:

The 'use' attribute is not supported in this context.

实际上,xsd包含属性use="required"
<xs:attribute name="sch" type="xs:string" use="required"/>

DataSet ds = new DataSet();
ds.ReadXmlSchema(@"C:\Schema\Schema.xsd");

有什么想法是错的吗?
1个回答

0
你只有在定义全局属性时才会收到此错误消息。只有当属性是内容模型的一部分时,你才能使用它。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接