1. XML数据类型
| 简单类型 | 实例和解释 |
| string | "this is a string" |
| boolean | true, false |
| float | single-precision floating point |
| double | double precision 64-bit floating point |
| decimal | 123.45 |
| integer | -12345; 0; 12345 |
| non-positive-integer | -12345; 0 |
| negative-integer | -12345 |
| long | 1234567890123 |
| int | 123456789 |
| short | 12345 |
| byte | 123 |
| non-negative-integer | 0; 123456 |
| unsigned-long | 123456789012345 |
| unsigned-int | 1234567801 |
| unsigned-short | 12345 |
| unsigned-byte | 123 |
| positive-integer | 123456 |
| date | 2000-02-16 |
| time | 15:55:00.000 |
| timeInstant | 2000-12-31T05:55:00.000 (5:55 am, Coordinated Universal Time) |
| timeDuration | P5Y1M4D10H20M1.2S (5 years; 1 month; 4 days; 20 minutes; 1.2 seconds) |
| recurringInstant | --02-16T5:55:00 (February 16th every year at 5:55 am. Coordinated Universal Time) |
| binary | bit pattern |
| uri-reference | standard URL |
| ID* | XML 1.0 Compatibility |
| IDREF* | XML 1.0 Compatibility |
| ENTITY* | XML 1.0 Compatibility |
| NOTATION* | XML 1.0 Compatibility |
| language | en-US (see xml:lang in XML 1.0) |
| IDREFS* | XML 1.0 Compatibility |
| ENTITIES* | XML 1.0 Compatibility |
| NMTOKEN* | XML 1.0 Compatibility |
| NMTOKENS* | XML 1.0 Compatibility |
| Name | see XML 1.0 |
| QName | (Prefix ':')? NCName = LocalPart (e.g.; po:Address) |
| NCName | (letter | '_') (NCNameChar)*
*Use only in attributes to ensure compatibility with XML 1.0 DTD. |
1. Schema标识
| Item | Function | |
| element | 元素标识 | |
| name | 元素名称 | |
| type | 元素类型 |
|
| default | 元素默认值, 可有可无 | |
| fixed | 元素不能覆盖好修改的固定值,可有可无 | |
2. XSD有三种定义元素的方式:
- 全定义方式
<xs:element name="元素名称"> <元素的结构类型定义></元素的结构类型定义> </xs:element> - 结构类型/数据类型引用方式
<xs:element name="元素名称" type="元素的结构类型名称|数据类型名称" /> - 元素引用方式
<xs:element ref="引用元素定义的ID" />
本文介绍了XML中的简单数据类型及其示例,并详细说明了如何使用XSD定义XML元素的结构和类型,包括全定义方式、结构类型引用方式及元素引用方式。
5487

被折叠的 条评论
为什么被折叠?



