XML Schema any要素
完全な XML Schema リファレンスマニュアル
定義と使用法
any 要素を使用すると、作成者はスキーマで規定されていない要素を使用して XML ドキュメントを拡張できます。
要素情報
- 親要素: choice, sequence
構文
<any
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</any>
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</any>
(? 記号は、要素が任意の要素内に 0 回または 1 回出現できることを宣言します。)
| 属性 | 説明 |
|---|---|
| id | 任意(オプション)。この要素の一意の ID を指定します。 |
| maxOccurs | 任意(オプション)。any 要素が親要素内に出現できる最小回数を指定します。この値は 0 以上の整数です。この any グループをオプションにする場合は、この属性を 0 に設定します。デフォルトは 1 です。 |
| minOccurs | Optional. Specifies the minimum number of times the any element can occur in the parent element. The value can be any number >= 0. Default value is 1 |
| namespace | 任意(オプション)。使用できる要素を含む名前空間を指定します。名前空間が指定されていない場合、##any がデフォルト値です。名前空間を指定する場合、次のいずれかの値でなければなりません:
|
| processContents | 任意(オプション)。アプリケーションまたは XML プロセッサが、この any 要素によって指定された要素に基づいて、XML ドキュメントの検証をどのように処理するかを示す指示子。processContents 属性が指定されていない場合、デフォルトは strict です。processContents を指定する場合、次のいずれかの値でなければなりません:
|
| any attributes | 任意(オプション)。non-schema 名前空間を持つその他の属性を指定します。 |
例 1
以下の例は、"person" 要素の宣言を示しています。<any> 要素を使用することで、作成者は任意の要素を使用して(<lastname> の後に)"person" の内容を拡張できます。
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:any minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:any minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
完全な XML Schema リファレンスマニュアル その他の拡張