XML Schema any element
Definition and Usage
any element so that creators can be extended by an XML document element is not specified by the schema.
Element Information
- Parent element: choice, sequence
grammar
<any
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</any>
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
namespace=namespace
processContents=lax|skip|strict
any attributes
>
(annotation?)
</any>
(? Sign declares that the element can occur zero or one time in any element.)
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
maxOccurs | 可选。规定 any 元素在父元素中可出现的最小次数。该值可以是大于或等于零的整数。若要指定该 any 组是可选的,请将此属性设置为零。 默认值为 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 | 可选。规定包含可以使用的元素的命名空间。如果没有指定命名空间,则 ##any 为默认值。 如果指定命名空间,则必须是以下值之一:
|
processContents | 可选。一个指示符,指示应用程序或 XML 处理器应如何根据由该 any 元素指定的元素处理 XML 文档的验证。 如果没有指定 processContents 属性,则默认为 strict。 如果指定了 processContents,必须是以下值之一:
|
any attributes | 可选。规定带有 non-schema 命名空间的任何其他属性。 |
Example 1
The following example shows a declaration "person" element. By using the <any> element, creators can use any element extended "person" of the content (in <lastname> after):
<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>
<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>
Complete XML Schema Reference