Lược đồ XML Phần tử thuộc tính bất kỳ
❮ Tham chiếu lược đồ XML hoàn chỉnh
Định nghĩa và cách sử dụng
Phần tử AnyAttribution 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, hạn chế (cả simpleContent và complexContent), phần mở rộng (cả simpleContent và complexContent), attributeGroup
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 0 hoặc một lần bên trong phần tử AnyAttribution)
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 hiển thị phần khai báo cho một phần tử có tên là "person". Bằng cách sử dụng phần tử <anyAttribution>, 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