xs:choice-1つだけ出現させる指定の記述例
XML Schema文書の例
<?xml version="1.0" encoding="Shift_JIS" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <!-- 要素宣言 -->
  <xs:element name="x" type="xType"/>
  <!-- 複合型定義 -->
  <xs:complexType name="xType">
    <xs:choice>
      <xs:element name="a" type="xs:string" />
      <xs:element name="b" type="xs:string" />    
    </xs:choice>
   </xs:complexType>
</xs:schema>
妥当なXML文書の例
<x>
  <a/>
</x>
<x>
  <b/>
</x>
妥当でないXML文書の例
<x>
  <a/>
  <b/>
</x>
<x/>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License