当前位置: 首页 > 网络学院 > XML相关教程 > Schema (XSD) > XSD 字符串数据类型
String data types are used for values that contains character strings.
字符串数据类型是用于定义包含字符串的值的。
The string data type can contain characters, line feeds, carriage returns, and tab characters.
字符串数据类型包括字符、换行符、回车符和制表符。
The following is an example of a string declaration in a schema:
下面是关于字符在schema内声明方法的案例:
<xs:element name="customer" type="xs:string"/> |
An element in your document might look like this:
你的文档中或许包含这样的元素:
<customer>John Smith</customer> |
Or it might look like this:
或者,它是这样的:
<customer> John Smith </customer> |
Note: The XML processor will not modify the value if you use the string data type.
注意:如果你使用字符串数据类型,XML处理器将不会对数值进行修改。
The normalizedString data type is derived from the String data type.
规格化的字符串数据类型是从字符数据类型中派生出来的。
The normalizedString data type also contains characters, but the XML processor will remove line feeds, carriage returns, and tab characters.
规格化的字符串数据类型也同时包括字符,但XML 处理器会删除换行符、回车符和制表符。
The following is an example of a normalizedString declaration in a schema:
下述案例是关于一个规格化的字符串数据类型在Schema中的声明方法:
<xs:element name="customer" type="xs:normalizedString"/> |
An element in your document might look like this:
你的文档中或许包含了下述元素:
<customer>John Smith</customer> |
Or it might look like this:
或者,它是这样的:
<customer> John Smith </customer> |
Note: In the example above the XML processor will replace the tabs with spaces.
注意:上述案例中,XML处理器会使用空格符替代制表符。
The token data type is also derived from the String data type.
符号数据类型也是从字符串数据类型中派生出来的。
The token data type also contains characters, but the XML processor will remove line feeds, carriage returns, tabs, leading and trailing spaces, and multiple spaces.
符号数据类型也可以包含字符,但XML处理器会删除换行符、回车符、制表符、首尾空格,以及重复空格。
The following is an example of a token declaration in a schema:
下面是关于符号在schema中声明的案例:
<xs:element name="customer" type="xs:token"/> |
An element in your document might look like this:
下面列举了你文档中的一个元素:
<customer>John Smith</customer> |
Or it might look like this:
或者也可能是这样:
<customer> John Smith </customer> |
Note: In the example above the XML processor will remove the tabs.
注意:在上述例子中,XML处理器会删除制表符。
Note that all of the data types below derive from the String data type (except for string itself)!
注意:下面所有的数据类型都是从字符串数据类型中派生出来的(字符串本身除外)。
Name 名称 | Description 解释 |
---|---|
ENTITIES | |
ENTITY | |
ID | A string that represents the ID attribute in XML (only used with schema attributes) 表示XML的ID属性的字符串(只能在schema属性中使用) |
IDREF | A string that represents the IDREF attribute in XML (only used with schema attributes) 表示XML里的IDREF属性的字符串(只能和schema属性一起使用) |
IDREFS | |
language | A string that contains a valid language id 包含一个有效语言ID的字符串 |
Name | A string that contains a valid XML name 包含一个有效XML名称的字符串 |
NCName | |
NMTOKEN | A string that represents the NMTOKEN attribute in XML (only used with schema attributes) 表示XML中的NMTOKEN属性的字符串(只能和schema属性一起使用) |
NMTOKENS | |
normalizedString | A string that does not contain line feeds, carriage returns, or tabs 不含换行符、回车符或制表符的字符串 |
QName | |
string | A string 一个字符串 |
token | A string that does not contain line feeds, carriage returns, tabs, leading or trailing spaces, or multiple spaces 不包含换行符、回车符、制表符、首尾空格或重复空格的字符串 |
Restrictions that can be used with String data types:
可约束的字符串数据类型如下: