XML Schema 参考手册 完整 XML Schema 参考手册 The any element enables the creator to extend the XML document through elements that are not specified by schema. 父元素: Choice, sequence (? The symbol declares that an element can appear zero or once within any element. ) Attribute Description Id Optional. Specifies the unique ID of the element. MaxOccurs Optional. Specifies the minimum number of times an any element can appear in the parent element. The value can be an integer greater than or equal to zero. To specify that the any group is optional, set this property to zero. The default value is 1. MinOccurs Optional. Specifies the minimum number of times the any element can occur in the parent element. The value can be any number > = 0. Default value is 1 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 of the “person” element. By using the < any > element, the creator can extend the content of “person” with any element (after < lastname >):Definition and usage ¶
Element information ¶
Grammar ¶
<any
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
namespace=namespace
processContents=lax|skip|strict
*any attributes*
>
(annotation?)
</any>
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:any minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>