XML-схема Элемент anyAttribute
❮ Полный справочник по XML-схеме
Определение и использование
Элемент anyAttribute позволяет автору расширить XML-документ атрибутами, не указанными в схеме.
Информация об элементе
- Родительские элементы: complexType, ограничение (как simpleContent, так и complexContent), расширение (как simpleContent, так и complexContent), attributeGroup
Синтаксис
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</anyAttribute>
(Знак ? указывает, что элемент может встречаться ноль или один раз внутри элемента 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 |
Пример 1
В следующем примере показано объявление для элемента с именем «человек». Используя элемент <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-схеме