这是我的XSD的一部分:
<xs:attributeGroup name="matches">
<xs:attribute name="min-matches" type="positiveInt" default="1" use="optional" />
<xs:attribute name="max-matches" type="positiveIntUnbounded" default="1" use="optional" />
</xs:attributeGroup>
<xs:attributeGroup name="pathAndMatches">
<xs:attribute name="path" type="xs:string" use="required" />
<xs:attributeGroup ref="matches" />
</xs:attributeGroup>
当我使用.NET FX的xsd.exe
时,它只在元素中引用pathAndMatches
时才生成path
属性。为什么它不为min/max匹配生成属性?我的XSD无效吗?xsd.exe不显示任何错误或警告。
发布于 2019-03-21 05:29:09
不幸的是,xsd.exe不支持嵌套属性组。请参阅文档中的以下说明:
元素不能嵌套在另一个元素中。嵌套实例将被Xsd.exe工具忽略。
http://msdn2.microsoft.com/en-us/library/484632e7.aspx
液态XML数据绑定器支持它们。如果您的项目不太大,您可以使用免费的社区版本生成它。
https://stackoverflow.com/questions/55276123
复制相似问题