Esquema XML anyAttribute Element
❮ Referência Completa do Esquema XML
Definição e uso
O elemento anyAttribute permite que o autor estenda o documento XML com atributos não especificados pelo esquema.
Informações do elemento
- Elementos pai: complexType, restrição (ambos simpleContent e complexContent), extensão (ambos simpleContent e complexContent), attributeGroup
Sintaxe
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</anyAttribute>
(O sinal ? declara que o elemento pode ocorrer zero ou uma vez dentro do elemento anyAttribute)
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 |
Exemplo 1
O exemplo a seguir mostra uma declaração para um elemento chamado "person". Usando o elemento <anyAttribute> o autor pode adicionar qualquer número de atributos ao elemento "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>
❮ Referência Completa do Esquema XML