schema 元素定义 schema 的根元素。
出现次数 | 一次 |
父元素 | (无父元素) |
内容 | include、import、annotation、redefine、attribute、attributeGroup、element、group、notation、simpleType、complexType |
</>code
- <schema
- id=ID
- attributeFormDefault=qualified|unqualified
- elementFormDefault=qualified|unqualified
- blockDefault=(#all|list of (extension|restriction|substitution))
- finalDefault=(#all|list of (extension|restriction|list|union))
- targetNamespace=anyURI
- version=token
- xmlns=anyURI
- any attributes
- >
- ((include|import|redefine|annotation)*,(((simpleType|complexType|
- group|attributeGroup)|element|attribute|notation),annotation*)*)
- </schema>
可选。规定该元素的唯一的 ID。
可选。在该 schema 的目标命名空间中声明的属性的形式。该值必须是下列字符串之一: "qualified" 或 "unqualified"。 默认值为 "unqualified"。
可选。在该 schema 的目标命名空间中声明的元素的形式。该值必须是下列字符串之一: "qualified" 或 "unqualified"。 默认值为 "unqualified"。
可选。规定在目标命名空间中 element 和 complexType 元素上的 block 属性的默认值。block 属性防止具有指定派生类型的复杂类型(或元素)被用来代替继承的复杂类型(或元素)。该值可以包含 #all 或者一个列表,该列表是 extension、restriction 或 substitution 的子集:
可选。规定在该架构的目标命名空间中 element、simpleType 和 complexType 元素的 final 属性的默认值。final 属性防止 element、simpleType 或 complexType 元素的指定的派生类型。对于 element 和 complexType 元素,该值可以包含 #all 或一个列表,该列表是 extension 或 restriction 的子集。 对于 simpleType 元素,该值还可以包含 list 和 union:
该 schema 的命名空间的 URI 引用。还可以分配该命名空间的前缀。如果没有分配任何前缀,则该命名空间的 schema 组件可以和非限定的引用一起使用。
可选。规定 schema 的版本。
规定在此 schema 中使用的一个或多个命名空间的 URI 引用。如果没有分配前缀,该命名空间的 schema 组件可与未限制的引用使用。
可选。规定带有 non-schema 命名空间的任何其他属性。
</>code
- <?xml version="1.0"?>
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="values" type="xs:string">
- </xs:schema>
在本例中,http://www.w3.org/2001/XMLSchema 命名空间中 schema 组件 (element name, type) 是未限制的,而 https://www.365jz.com/365jzchema (mystring) 是通过 wsc 前缀限制的:
</>code
- <?xml version="1.0"?>
- <schema xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:wsc="https://www.365jz.com/365jzchema">
- <element name="fname" type="wsc:mystring"/>
- </schema>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛