XML-Schema anyAttribute- Element
❮ Vollständige XML-Schema-Referenz
Definition und Verwendung
Das Element anyAttribute ermöglicht es dem Autor, das XML-Dokument mit Attributen zu erweitern, die nicht durch das Schema angegeben sind.
Elementinformationen
- Übergeordnete Elemente: complexType, Beschränkung (sowohl simpleContent als auch complexContent), Erweiterung (sowohl simpleContent als auch complexContent), attributeGroup
Syntax
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</anyAttribute>
(Das ?-Zeichen gibt an, dass das Element null oder einmal innerhalb des anyAttribute-Elements vorkommen kann.)
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 |
Beispiel 1
Das folgende Beispiel zeigt eine Deklaration für ein Element namens "Person". Durch die Verwendung des Elements <anyAttribute> kann der Autor dem Element "person" beliebig viele Attribute hinzufügen:
<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>
❮ Vollständige XML-Schema-Referenz