标签:value table restrict ddr zip ext 包括 str 枚举
1.简单数据类型
(1)内置简单数据类型
schema中定义了一些简单数据类型,包括primitive原始数据类型和derived派生数据类型,这些类型都是schema中使用的
最基本的数据类型,我们可以用他们自定义简单数据类型
表:primitive原始数据类型
| 数据类型 | 描述 |
| string | 字符串 |
| Boolean | 布尔值 |
| decimal | 十进制数字 |
| float | 32位浮点数 |
| double | 64位浮点数 |
| timeDuration | 标识持续时间 |
| datetime | 特定时间 |
| time | |
| date | |
| anyURI | 代表URI,用来定位文件 |
| recurring Duration |
派生数据类型
| 数据类型 | 描述 |
| integer | |
| long | [-263,263-1] |
| nonNegativeInteger | 大于等于零的整数 |
| positiveInteger | 大于零的整数 |
| int | [-231,231-1] |
| time | s |
| date |
(2)自定义简单数据类型
<xs:simpleType name="phoneno"> <xs:restriction base="xs:string"> <xs:length value="3" /> <xs:pattern value="\d{4}-\d{3}" /> </xs:restriction> </xs:simpleType>
simpleType元素常用子元素
| 子元素 | 作用 |
| enumeration | 枚举类型,供用户选择 |
| fractionDigits | 限定最大的小数位,用户控制精度 |
| length | 自定数据的长度 |
| maxExclusive | 指定数据的最大值(小于) |
| maxInclusive | 指定数据的最大值(小于等于) |
| maxLength | 指定长度的最大值 |
| minExclusive | 指定最小值(大于) |
| minInclusive | 指定最小值(小于等于) |
| minLength | 指定最小长度 |
| pattern | 正则 |
e.g.
<xs:simpleType name="gender"> <xs:restriction base="xs:string"> <xs:enumeration value="男"/> <xs:enumeration vlaue="女"/> </xs:restriction> </xs:simpleType>
2.复杂数据类型
<xs:complexType name="">
<内容模板定义(包括子元素和属性的声明)
</xs:complexType>
e.g.
1 <xs:complexType name="address"> 2 <xs:sequence> 3 <xs:element name="street" type="xs:string" /> 4 <xs:element name="city" type="xs:string" /> 5 <xs:element name="state" type="xs:string" /> 6 <xs:element name="zip" type="xs:decimal" /> 7 </xs:sequence> 8 </xs:complexType>
标签:value table restrict ddr zip ext 包括 str 枚举
原文地址:http://www.cnblogs.com/zhuxiang1633/p/7637955.html