这个 XSD 限制是什么意思。具有限制的派生类型只是基类型的属性
What does this XSD restriction mean. Derived type with restriction just an attribute of the base type
有一个基本类型“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 规范。您的复杂类型是 'complex type with simple content',因此相关部分是:
https://www.w3.org/TR/xmlschema-1/#declare-type,小节Complex Type Definition with simple content Schema Component
3 if the type definition ·resolved· to by the ·actual value· of the base [attribute] is a complex type definition, the {attribute uses} of that type definition, unless the alternative is chosen, in which case some members of that type definition's {attribute uses} may not be included, namely those whose {attribute declaration}'s {name} and {target namespace} are the same as one of the following:
3.1 the {name} and {target namespace} of the {attribute declaration} of an attribute use in the set per clause 1 or clause 2 above;
3.2 what would have been the {name} and {target namespace} of the {attribute declaration} of an attribute use in the set per clause 1 above but for the ·actual value· of the use [attribute] of the relevant among the [children] of being prohibited.
用简单的英语来说,这意味着复杂类型限制必须重新声明它想要保留的任何属性——它们不会自动继承。所以派生类型“ObjectNummering-geoBAG”只有 1 个属性,而不是 2 个。
有一个基本类型“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 规范。您的复杂类型是 'complex type with simple content',因此相关部分是:
https://www.w3.org/TR/xmlschema-1/#declare-type,小节Complex Type Definition with simple content Schema Component
3 if the type definition ·resolved· to by the ·actual value· of the base [attribute] is a complex type definition, the {attribute uses} of that type definition, unless the alternative is chosen, in which case some members of that type definition's {attribute uses} may not be included, namely those whose {attribute declaration}'s {name} and {target namespace} are the same as one of the following: 3.1 the {name} and {target namespace} of the {attribute declaration} of an attribute use in the set per clause 1 or clause 2 above; 3.2 what would have been the {name} and {target namespace} of the {attribute declaration} of an attribute use in the set per clause 1 above but for the ·actual value· of the use [attribute] of the relevant among the [children] of being prohibited.
用简单的英语来说,这意味着复杂类型限制必须重新声明它想要保留的任何属性——它们不会自动继承。所以派生类型“ObjectNummering-geoBAG”只有 1 个属性,而不是 2 个。