Lược đồ XML anyAttribute Element
❮ Tham chiếu lược đồ XML hoàn chỉnh
Định nghĩa và Cách sử dụng
Phần tử anyAttribute cho phép tác giả mở rộng tài liệu XML với các thuộc tính không được lược đồ chỉ định.
Thông tin phần tử
- Các phần tử gốc: complexType, Restricted (cả simpleContent và complexContent), phần mở rộng (cả simpleContent và complexContent), thuộc tínhGroup
Cú pháp
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</anyAttribute>
(Dấu? Khai báo rằng phần tử có thể xuất hiện không hoặc một lần bên trong phần tử 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 |
ví dụ 1
Ví dụ sau đây cho thấy một khai báo cho một phần tử được gọi là "người". Bằng cách sử dụng phần tử <anyAttribute>, tác giả có thể thêm bất kỳ số lượng thuộc tính nào vào phần tử "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>
❮ Tham chiếu lược đồ XML hoàn chỉnh