学习笔记——XML Schema自定义简单数据类型

XML Schema规范共推荐12种约束。

范围约束

minInclusice、manInclusice、minExclusive、maxExcusive

长度约束 length、minLength、maxLength
精度约束 fractionDigits、totalDigits
枚举约束 enumeration
正则表达式约束 pattern
空白处理 whiteSpace

 

fractionDigits:用于定义十进制数小数部分的精度。

totalDigits:用于指定decimal及其派生类型的数值精度。

whiteSpace:指定字符串中空白的处理方式,preserve(保留空白)、replace(字符串中Newline、tab和carriage-return都会被替换成空白)、collapse(字符串中Newline、tab和carriage-return都会被替换成空白,并且字符串中间连续的空白会被压缩成一个,字符串前后的空白会被自动删除)。

 

 约束的使用方式:

 

<xs:facet value="option" />

 

Table B1.a. Simple Types & Applicable Facets
Simple Types Facets
  length minLength maxLength pattern enumeration whiteSpace
string y y y y y y
normalizedString y y y y y y
token y y y y y see (1)
base64Binary y y y y y see (1)
hexBinary y y y y y see (1)
integer       y y see (1)
positiveInteger       y y see (1)
negativeInteger       y y see (1)
nonNegativeInteger       y y see (1)
nonPositiveInteger       y y see (1)
long       y y see (1)
unsignedLong       y y see (1)
int       y y see (1)
unsignedInt       y y see (1)
short       y
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值