指定した名前空間の任意の属性をコンテナ complexType 要素またはコンテナ attributeGroup 要素内に含めることができます。
<anyAttribute
id = ID
namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local))) : ##any
processContents = (lax | skip | strict): strict
{any attributes with non-schema Namespace...}>
Content: (annotation?)
</anyAttribute>
属性
id
この要素の ID。id の値は ID 型である必要があり、この要素を含んでいるドキュメント内で一意である必要があります。省略可能です。
namespace
使用できる属性が含まれている名前空間。名前空間を指定しなかった場合は、既定の ##any が設定されます。名前空間を指定する場合は、次のいずれかを指定する必要があります。##any 任意の名前空間の属性を使用できます。 ##other この anyAttribute 要素を含んでいる親要素の対象名前空間以外の任意の名前空間の属性を使用できます。 ##local 名前空間で限定されていない属性を使用できます。 ##targetNamespace この anyAttribute 要素を含む親要素の対象名前空間の属性を使用できます。 List of {URI references, ##targetNamespace, ##local} スペースで区切られた名前空間のリストからの属性を使用できます。名前空間のリストには、名前空間の URI 参照、##targetNamespace、および ##local を含めることができます。 省略可能です。
processContents
アプリケーションまたは XML プロセッサがこの anyAttribute 要素によって指定された属性と比較して XML ドキュメントを検証する方法を示すインジケータ。processContents 属性を指定しなかった場合は、既定の strict が設定されます。processContents を指定する場合は、次のいずれかを指定する必要があります。strict XML プロセッサは、要求された名前空間に対応するスキーマを取得し、それらの名前空間からの属性を検証する必要があります。 lax XML プロセッサは、要求された名前空間に対応するスキーマを取得し、それらの名前空間からの属性を検証しますが、スキーマを取得できない場合でもエラーになりません。 skip XML プロセッサは、指定した名前空間からの属性を検証しません。 省略可能です。
要素情報
出現回数 | 無制限 |
親要素 | complexType、restriction (simpleContent)、extension (simpleContent)、restriction (complexContent)、extension (complexContent)、attributeGroup |
コンテンツ | annotation |
例
文字列を含み、対象名前空間からの任意の属性を保持できる要素の要素宣言の例を次に示します。
<xs:element name="stringElementWithAnyAttribute">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:anyAttribute namespace="##targetNamespace"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
参照
XML スキーマ リファレンス (XSD) | XML スキーマの要素
詳細については、http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-anyAttribute で、W3C『XML Schema Part 1: Structures Recommendation』を参照してください。