XMLスキーマanyAttribute要素
❮完全なXMLスキーマリファレンス
定義と使用法
anyAttribute要素を使用すると、作成者はスキーマで指定されていない属性を使用してXMLドキュメントを拡張できます。
要素情報
- 親要素: complexType、restriction(simpleContentとcomplexContentの両方)、extension(simpleContentとcomplexContentの両方)、attributeGroup
構文
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</anyAttribute>
(?記号は、要素がanyAttribute要素内で0回または1回発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
namespace | Optional. Specifies the namespaces containing the
attributes
that can be used. Can be set to one of the following:
|
processContents | Optional. Specifies how the XML processor should handle
validation against the elements specified by this any element. Can be set to
one of the following:
|
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例1
次の例は、「person」という要素の宣言を示しています。<anyAttribute>要素を使用することにより、作成者は「person」要素に任意の数の属性を追加できます。
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
<xs:anyAttribute/>
</xs:complexType>
</xs:element>
❮完全なXMLスキーマリファレンス