加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

XMLSchema内置简单类型

发布时间:2020-12-15 22:31:47 所属栏目:百科 来源:网络整理
导读:XML Schema内置简单类型 Table 2. Simple Types Built In to XML Schema Simple Type Examples (delimited by commas) Notes string Confirm this is electric normalizedString Confirm this is electric see (3) token Confirm this is electric see (4) b

XML Schema内置简单类型

Table 2. Simple Types Built In to XML Schema

Simple Type

Examples (delimited by commas)

Notes

string

Confirm this is electric

normalizedString

Confirm this is electric

see (3)

token

Confirm this is electric

see (4)

base64Binary

GpM7

hexBinary

0FB7

integer

...-1,1,...

see (2)

positiveInteger

1,2,...

see (2)

negativeInteger

... -2,-1

see (2)

nonNegativeInteger

0,...

see (2)

nonPositiveInteger

... -2,-1,0

see (2)

long

-9223372036854775808,... -1,... 9223372036854775807

see (2)

unsignedLong

0,... 18446744073709551615

see (2)

int

-2147483648,... 2147483647

see (2)

unsignedInt

0,...4294967295

see (2)

short

-32768,... 32767

see (2)

unsignedShort

0,... 65535

see (2)

byte

-128,...-1,... 127

see (2)

unsignedByte

0,... 255

see (2)

decimal

-1.23,123.4,1000.00

see (2)

float

-INF,-1E4,-0,12.78E-2,12,INF,NaN

equivalent to single-precision 32-bit floating point,NaN is "not a number",see (2)

double

-INF,NaN

equivalent to double-precision 64-bit floating point,see (2)

boolean

true,false,0

duration

P1Y2M3DT10H30M12.3S

1 year,2 months,3 days,10 hours,30 minutes,and 12.3 seconds

dateTime

1999-05-31T13:20:00.000-05:00

May 31st 1999 at 1.20pm Eastern Standard Time which is 5 hours behind Co-Ordinated Universal Time,see (2)

date

1999-05-31

see (2)

time

13:20:00.000,13:20:00.000-05:00

see (2)

gYear

1999

1999,see (2) (5)

gYearMonth

1999-02

the month of February 1999,regardless of the number of days,see (2) (5)

gMonth

--05

May,see (2) (5)

gMonthDay

--05-31

every May 31st,see (2) (5)

gDay

---31

the 31st day,see (2) (5)

Name

shipTo

XML 1.0 Name type

QName

po:USAddress

XML Namespace QName

NCName

USAddress

XML Namespace NCName,i.e. a QName without the prefix and colon

anyURI

http://www.example.com/,

http://www.example.com/doc.html#ID5

language

en-GB,en-US,fr

valid values for xml:lang as defined in XML 1.0

ID

XML 1.0 ID attribute type,see (1)

IDREF

XML 1.0 IDREF attribute type,see (1)

IDREFS

XML 1.0 IDREFS attribute type,see (1)

ENTITY

XML 1.0 ENTITY attribute type,see (1)

ENTITIES

XML 1.0 ENTITIES attribute type,see (1)

NOTATION

XML 1.0 NOTATION attribute type,see (1)

NMTOKEN

US,

Brésil

XML 1.0 NMTOKEN attribute type,see (1)

NMTOKENS

US UK,

Brésil Canada Mexique

XML 1.0 NMTOKENS attribute type,i.e. a whitespace separated list of NMTOKEN's,see (1)

Notes: (1) To retain compatibility between XML Schema and XML 1.0 DTDs,the simple types ID,IDREF,IDREFS,ENTITY,ENTITIES,NOTATION,NMTOKEN,NMTOKENS should only be used in attributes. (2) A value of this type can be represented by more than one lexical format,e.g. 100 and 1.0E2 are both valid float formats representing "one hundred". However,rules have been established for this type that define a canonical lexical format,seeXML Schema Part 2. (3) Newline,tab and carriage-return characters in a normalizedString type are converted to space characters before schema processing. (4) As normalizedString,and adjacent space characters are collapsed to a single space character,and leading and trailing spaces are removed. (5) The "g" prefix signals time periods in the Gregorian calendar.

一.基于字符串的类型

1. string:模式处理器在处理string类型的值,会将值中的所有空白符(空格、制表符、回车和换行)都保留。

2. normalizedString:模式处理器遇到该类型的内容时,会用单个空格来替换它读到的每一个回车,换行和制表符。如果该类型的内容中有多个连续的空格,那么这些连续的空格并不会被压缩成单个的空格

3. token:模式处理器遇到该类型的内容时,会用单个的空格来替换它读取到的每一个回车、换行和制表符。在替换之后,每一组连续的空格都被压缩成为一个空格字符,而所有签到空格和结尾空格都删除。

4. Name他表示XML名称,即该类型的值必须以字母、下划线或冒号开头,而且只能包含字母、数字、连字符(-)、下划线、冒号或句号(.)。不过冒号应该用于分割名称空间前缀和本地名称,如果没有使用名称空间,则不建议使用冒号。

5. NCName:基本与Name相同,而不同之处在于,该类型中不能包含冒号。

5种类型,自上而下是派生的关系。


二.数字类型

1. floatdouble(浮点数和双精度浮点数)

可使用科学计数法表示;下列值都是有效的:INF(无穷大),-INF(负无穷大)0(正零)、-0(负零)和NaN(非数字);注:正零大于负零,非数字大于所有其他值,包括正无穷大。

2. decimal(小数)

表示任意精度的小数,不同的模式处理器支持的有效位数是不一样的,不过需要最少支持18位有效数字。

.2 2.以及0022.00是符合标准的decimal数字。

3. integer(整数)

派生自decimal,表示一任意大的证书,从integer数据类型派生出了其他十二种内置类型,例如Byte,Int等。

三.日期和时间类型

1. date格式为:YYYY-MM-DD,若是9999以后的年份可以在最左端添加数字,但是不允许有前导0

若要表示公园前的年,可以在年之前面添加减号例如-0343-03-22表示公元前343322日。

可以在日期值后添加可选的时区表达式,或者添加字符Z,表示UTC时间。例如:1978-05-04+08:00

2. time格式为:hh:mm:ss:sss,例如:14:20:20.888。时间是24小时制,可添加可选的时区表达式。其中sss是可选的。

3. dateTime格式为:YYYY-MM-DDThh:mm:ss:sss.字母T作为日期和时间的分隔。同样可添加可选的时区表达式。

4. gYear表示一个特定的阳历年,格式为YYYY.

5. gYearMonth表示特定年中的特定月,格式为YYYY-MM

6. gMonth表示每年都出现的特定月,格式为--MM,前导的两个连字符是必须的。

7. gMonthDay表示每年都出现的特定的一天。格式为--MM-DD.

8. gDay格式为- -DD

9. duration格式为PnYnMnDTnH nMnSP为表达式的开始,例:P3Y5M4DT14H20M30S表示35个月414个小时20分钟30秒。可在P前加个-号标示符的持续时间。

年月日小时分钟数都可以是任意的无符号整数,而秒数则可以是任意的无符号小数,除此之外,duration的值还遵循下列的规则:

l 任意一部分为为0,那么该部分可以忽略,然而至少要有一个数字和他的标示符出现。

l 描述部分如果出现了小数点,则必须紧随其后至少一个数字。

l 如果出现时间项,则必须有T,反之,T不能出现。

l P必须总是出现的。

四.其他数据类型

1.boolean有效值为0,1truefalse

2.anyURI表示同意资源标识符的引用。

3.QName表示XML名称空间限定名,包括一个前缀名一个本地部分,中间用冒号分割,这两部分都是NCName类型。前缀和冒号都是可选的,但是如果使用了前缀,则要求在QName值得适用范围内使用该前缀变量的名称空间的声明,否则将出错。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读