.NET 的 XACML2 架构生成错误 - 无法在架构的顶层使用通配符
有人能够从 XACML2 模式文件成功生成 C# 实体类吗?我收到“无法在架构的顶层使用通配符”。我认为这与 xs:any 元素有关。我尝试更改 processContents="skip" (从“lax”)但无济于事。我使用 WSCF Blue 以及 xsd.exe。
Has anyone been able to successfully generate C# entity classes from XACML2 schema files? I am getting "Cannot use wildcards at the top level of a schema." I think this has something to do with xs:any elements. I have tried change the processContents="skip" (from "lax") but to no avail. I get this using WSCF Blue as well as xsd.exe.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 VS 2010 附带的 xsd.exe 版本非常适合我。
Works perfectly for me using the version of xsd.exe that ships w/ VS 2010.
我通过 VS2010 XSD.exe 运行 Xacml3 架构没有任何问题,但在尝试使用 XSD 处理 Xacml2 架构时,我确实看到了“无法在架构顶层使用通配符”错误。
XSD 处理 Xacml2 策略架构时没有错误。
处理 Xacml2 上下文架构时,XSD 报告此通配符错误。
问题似乎是
xacml-context:AttributeValueType
架构定义中##any
和mixed="true"
的组合。 Xacml2 策略架构和 Xacml3 中AttributeValueType
的其他定义使用xs:complexContent
包装器围绕ExpressionType
扩展,该扩展又包含xs :any
和xs:anyAttribute
定义。 Xacml2context:AttributeValueType
不包含此包装器。解决方案:从 Xacml2
xacml-context:AttributeValueType
定义中删除mixed="true"
,XSD 将为架构生成正确的类类型。生成的 AttributeValueType 类将具有元素列表和属性列表的属性,涵盖所有基础。I have no problems running the Xacml3 schema through VS2010 XSD.exe, but I do see this "Cannot use wildcards at the top level of a schema" error when trying to process the Xacml2 schema with XSD.
XSD processes the Xacml2 Policy schema with no errors.
XSD reports this wildcard error when processing the Xacml2 Context schema.
The issue appears to be the combination of
##any
andmixed="true"
in thexacml-context:AttributeValueType
schema definition. Other definitions ofAttributeValueType
in Xacml2 Policy schema and Xacml3 use anxs:complexContent
wrapper around anExpressionType
extension, which in turn containsxs:any
andxs:anyAttribute
definitions. The Xacml2context:AttributeValueType
does not contain this wrapper.Solution: Remove
mixed="true"
from the Xacml2xacml-context:AttributeValueType
definition and XSD will generate the correct class types for the schema. The generatedAttributeValueType
class will have properties for a list of elements and a list of attributes, which covers all the bases.