假設我有以下XSD文件:如何將限制與XSD文件中的出現指示符結合使用?
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="PACIDemoSignedDoc" type="PACIDemoSignedDocType" />
<xs:complexType name="PACIDemoSignedDocType">
<xs:all>
<xs:element name="OwnerEnglishName" type="OwnerEnglishNameType" />
</xs:all>
</xs:complexType>
<xs:complexType name="OwnerEnglishNameType">
<xs:simpleContent>
<xs:restriction base="NameType">
<xs:enumeration value="John"/>
<xs:enumeration value="Jack"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="NameType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
我的問題是,我應該在哪裏添加屬性的minOccurs和maxOccurs的元素「OwnerEnglishName」?我想保留xs:所有,因爲我想避免必須按順序排序我的XML文件,但它禁止直接在<xs:element name="OwnerEnglishName" type="OwnerEnglishNameType" />
行中添加Occurs ...
我也猜測我不能添加OwnerEnglishNameType中的Occur屬性,任何人有任何想法?
這是誰「禁止[你]添加」?我看不到,爲什麼' '(或類似的)不應該工作。 –
我想你的意思是錯誤'F [Saxon-EE 9.4.0.4]在之內,必須有@maxOccurs等於0或1'。請指定您想要的'minOccurs'和'maxOccures'值。 –
準確地說,我想添加不同於0和1的值:我沒有任何價值,我只需要爲這些屬性輸入任何值即可。 – Yohann