XML Schema 参考手册 完整 XML Schema 参考手册 The element element defines an element. 父元素: Schema, choice, all, sequence, group (? The symbol declaration is in the element element, which can appear zero or once, and the * symbol declares that the element can appear zero or more times. ) optional. Indicates whether an explicit zero value can be assigned to the element. This item applies to the content of the element and is not an attribute of the element. The default is false. If nillable is true, it enables the instance of the element to set the nil property to true. The nil attribute is defined as part of the instance’s XML schema namespace. Attribute Description Id Optional. Specifies the unique ID of the element. Name Optional. Specifies the name of the element. This attribute is required if the parent element is a schema element. Ref Optional. A reference to another element. The ref attribute can contain a namespace prefix. If the parent element is a schema element, this attribute is not used. Type Optional. Specify the name of the built-in data type, or specify the name of the simpleType or complexType element. SubstitutionGroup Optional. Specifies the name of the element that can be used to replace the element. The element must have the same type or a type derived from the specified element type. This attribute cannot be used if the parent element is not a schema element. Default Optional. Specify a default value for the element (used only if the element content is a simple type or textOnly). Fixed Optional. Specify a fixed value for the element (used only if the element content is a simple type or textOnly). Form Optional. The form of the element. The default value is the value of the elementFormDefault attribute of the schema element that contains the attribute. The value must be one of the following strings: “qualified” or “unqualified”. This attribute cannot be used if the parent element is a schema element. If the value is “unqualified”, you do not need to qualify the element with a namespace prefix. If the value is “qualified”, the element must be qualified with a namespace prefix. MaxOccurs Optional. Specifies the maximum number of times an element element can appear in the parent element. The value can be an integer greater than or equal to zero. If you do not want to set any limit on the maximum number of times, use the string “unbounded”. The default value is 1. This attribute cannot be used if the parent element is a schema element. MinOccurs Optional. Specifies the minimum number of times an element element can appear in the parent element. The value can be an integer greater than or equal to zero. The default value is 1. This attribute cannot be used if the parent element is a schema element. Nillable Abstract Optional. Indicates whether the element can be used in the instance document. If the value is true, the element cannot appear in the instance document. Instead, other elements whose substitutionGroup attribute contains the qualified name (QName) of the element must appear at the location of the element. Multiple elements can reference the element in their substitutionGroup attribute. The default value is false. Block Optional. The derived type. The block attribute prevents an element with a specified derived type from being used to replace that element. The value can contain # all or a list that is a subset of extension, restriction, or substitution: Extension-prevents an element derived from an extension from being used to replace it. Restriction-prevents an element derived by restriction from being used to replace it. Substitution-prevents a derived element from being replaced by replacing it. # all-prevents all derived elements from being used to replace this element. Final Optional. Sets the default value of the final attribute on the element element. This attribute cannot be used if the parent element is not a schema element. The value can contain # all or a list that is a subset of extension or restriction: Extension-prevents an element derived by extension from being used to replace it Restriction-prevents a derived element from being replaced by restricting it # all-prevents all derived elements from being used to replace this element Any attributes Optional. Specifies any other attributes with the non-schema namespace.Definition and usage ¶
Element information ¶
Grammar ¶
<element
id=ID
name=NCName
ref=QName
type=QName
substitutionGroup=QName
default=string
fixed=string
form=qualified|unqualified
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
nillable=true|false
abstract=true|false
block=(#all|list of (extension|restriction))
final=(#all|list of (extension|restriction))
*any attributes*
>
annotation?,(simpleType|complexType)?,(unique|key|keyref)\*
</element>