要素「テスト」が必要であることを検証したい
- コンテンツを制限する (たとえば、パターン制限を使用する)、および
- 特定の属性 (「id」、「class」、「name」など) を含みます。
私が書いているXSDは次のようになります。
<xsd:element name="Test" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType mixed="true">
<xsd:simpleContent>
<xsd:restriction>
<xsd:pattern value="xyz"/>
</xsd:restriction>
</xsd:simpleContent>
<xsd:attribute name="id" type="xsd:string"></xsd:attribute>
<xsd:attribute name="class" type="xsd:string"></xsd:attribute>
<xsd:attribute name="name" type="xsd:string"></xsd:attribute>
</xsd:complexType>
</xsd:element>
ただし、これを Visual Studio でコーディングすると、「xsd:attribute」要素で次のエラーが発生します。
「属性」とコンテンツ モデルは相互に排他的です
同じ要素のコンテンツ制限と属性の両方を検証する方法はありますか?