xsd - 这个 XSD 限制是什么意思。具有限制的派生类型只是基类型的一个属性
问题描述
有一个基本类型“Objectnummering-e”和一个派生类型“ObjectNummering-geoBAG”。“ObjectNummering-geoBAG”的限制提到了基本类型的属性。
我不清楚这是做什么的。对我来说,这两种类型是相同的。但他们是吗?
<complexType name="ObjectNummering-geoBAG">
<simpleContent>
<restriction base="BG:ObjectNummering-e">
<attribute ref="StUF:noValue"/>
</restriction>
</simpleContent>
</complexType>
<complexType name="ObjectNummering-e">
<simpleContent>
<extension base="BG:ObjectNummering">
<attributeGroup ref="StUF:element"/>
</extension>
</simpleContent>
</complexType>
<simpleType name="ObjectNummering">
<restriction base="string">
<length value="16"/>
</restriction>
</simpleType>
<attributeGroup name="element">
<attribute ref="StUF:noValue"/>
<attribute ref="StUF:exact"/>
</attributeGroup>
解决方案
与往常一样,回答此类问题的唯一可靠方法是查看 W3C 规范。您的复杂类型是“具有简单内容的复杂类型”,因此相关部分是:
https://www.w3.org/TR/xmlschema-1/#declare-type,小节Complex Type Definition with simple content Schema Component
3 如果由基[属性]的·实际值·解析的类型定义是一个复杂类型定义,则该类型定义的{属性使用},除非选择了替代方案,在这种情况下,该类型定义的某些成员类型定义的 {attribute uses} 可能不包括在内,即那些 {attribute declaration} 的 {name} 和 {target namespace} 与以下之一相同: 3.1 {name} 和 {target namespace}属性声明} 在上面第 1 条或第 2 条的集合中使用的属性;3.2 属性声明的{name}和{target namespace}会是什么儿童]被禁止。
用简单的英语来说,这意味着一个复杂的类型限制必须重新声明它想要保留的任何属性——它们不会自动继承。所以派生类型“ObjectNummering-geoBAG”只有 1 个属性,而不是 2 个。
推荐阅读
- node.js - 您可以从非 websocket lambda 向 websocket 客户端发送消息吗?
- python-3.x - 如何为删除 EBS 快照的 AWS Lamba 函数实施指数退避
- r - 根据 R 中的开始/结束时间绘制发生频率
- vue.js - 如何将一个响应拆分为多个 Vuex 模块?
- types - 如何统一采用 f64 和 Complex 的函数
? - ansible - 将已安装的 Homebrew 包收集为 MacOS 的 Ansible“事实”
- javascript - 如何复制而不丢失选择javascript?
- flutter - 如何制作一个 IconPicker,一个列出图标供用户选择的小部件
- aws-lambda - AWS Lambda 节流——为什么如此沮丧?
- django - 将许多上传的文件保存到 db save() 方法时,仅对查询中的最后一个文件有效