什么是正确的 XML Schema 声明:
...<answersList>
<question quest="Name?" cod="n_name">Variable Content</question>
<question quest="Weight?" cod="n_weight">Variable Content</question>
</answersList>...
这两个属性的每个值都应该在 XSD 枚举中。
到目前为止,我尝试过:(它不起作用)
<xs:element name="question">
<xs:complexType>
<xs:attribute name="quest">
<xs:restriction base="xs:string">
<xs:enumeration value="Name?"/>
<xs:enumeration value="Weight?"/>
</xs:restriction>
</xs:attribute>
<xs:attribute name="cod">
<xs:restriction base="xs:string">
<xs:enumeration value="n_name"/>
<xs:enumeration value="n_weight"/>
</xs:restriction>
</xs:attribute>
</xs:complexType>
</xs:element>
使用此网站进行测试: https ://www.freeformatter.com/xml-validator-xsd.html