XML Schema 参考手册 完整 XML Schema 参考手册 The anyAttribute element enables the creator to extend the XML document with attributes that are not specified by schema. 父元素: ComplexType, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent), attributeGroup (? The symbol declares that the element can occur zero or once within the anyAttribute element. ) Attribute Description Id Optional. Specifies the unique ID of the element. Namespace Optional. Specifies the namespace that contains elements that can be used. If no namespace is specified, # # any is the default. If you specify a namespace, it must be one of the following values. # # any-elements from any namespace can appear (default). # # other-elements from any namespace other than the target namespace of the element’s parent element can appear. # # local-elements that are not qualified by a namespace can appear. # # targetNamespace-elements from the target namespace of the parent element that contain the element can appear. List of {URI references of namespaces, # # targetNamespace, # # local}-elements from a list of namespaces separated by spaces can appear. The list can contain the following: URI references for namespaces # # targetNamespace and # # local. ProcessContents Optional. An indicator indicating how the application or XML processor should handle validation of the XML document based on the element specified by the any element. If no processContents attribute is specified, it defaults to strict. If processContents is specified, it must be one of the following values. The strict-XML processor must obtain the schema of the required namespaces and must validate all elements from those namespaces. (default) Lax-same as strict; however, even if the schema cannot be obtained, no error occurs. The skip-XML processor does not attempt to validate all elements from the specified namespace. Any attributes Optional. Specifies any other attributes with the non-schema namespace. The following example shows a declaration for the “person” element. By using elements, creators can add any number of attributes to the “person” element:Definition and usage ¶
Element information ¶
Grammar ¶
<anyAttribute
id=ID
namespace=namespace
processContents=lax|skip|strict
*any attributes*
>
(annotation?)
</anyAttribute>
Example 1 ¶
<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>