XML-schema elk attribuutelement
❮ Volledige XML-schemareferentie
Definitie en gebruik
Met het anyAttribute-element kan de auteur het XML-document uitbreiden met attributen die niet door het schema zijn gespecificeerd.
Elementinformatie
- Bovenliggende elementen: complexType, restrictie (zowel simpleContent als complexContent), extension (zowel simpleContent als complexContent), attributeGroup
Syntaxis
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</anyAttribute>
(Het ?-teken geeft aan dat het element nul of één keer kan voorkomen in het anyAttribute-element)
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 |
voorbeeld 1
Het volgende voorbeeld toont een declaratie voor een element met de naam "person". Door het <anyAttribute> element te gebruiken kan de auteur een willekeurig aantal attributen toevoegen aan het "person" element:
<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>
❮ Volledige XML-schemareferentie