您的位置:首页 > 其它

XSD 字符串数据类型

2007-04-06 14:18 274 查看
String data types are used for values that contains character strings.
字符串数据类型用于定义字符串的值的。

String Data Type
字符串数据类型

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(XML公式)里的声明方法的例子:

<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处理器将不会修改数值。

NormalizedString Data Type
规格化的字符串数据类型(NormalizedString Data Type)

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 processor会清除换行符,回车符和制表符

The following is an example of a normalizedString declaration in a schema:
下面的是关于一个规格化的字符串数据类型(normalizedString)在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处理器会用空格符替代制表符

Token Data Type
记号(token)数据类型

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:
下面是关于符号(token)在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处理器会清除制表符

String Data Types
字符串数据类型

Note that all of the data types below derive from the String data type (except for string itself)!
要注意下面所有的数据类型都是从字符串数据类型里派生出来的(除了字符串本身)

Name
名称
Description
解释
ENTITIES
ENTITY
IDA string that represents the ID attribute in XML (only used with schema attributes)
象征XML的ID属性的字符串(只用在schema属性里)
IDREFA string that represents the IDREF attribute in XML (only used with schema attributes)
象征XML里的IDREF属性的字符串(只能和schema属性一起使用)
IDREFS
languageA string that contains a valid language id
含有正确的语言ID的字符串
NameA string that contains a valid XML name
含有一个有效的XML名称的字符串
NCName
NMTOKENA string that represents the NMTOKEN attribute in XML (only used with schema attributes)
象征XML里的NMTOKEN属性的字符串(只能和schema属性一起使用)
NMTOKENS
normalizedStringA string that does not contain line feeds, carriage returns, or tabs
不含有换行符,回车符或制表符的字符串
QName
stringA string
一个字符串
tokenA string that does not contain line feeds, carriage returns, tabs, leading or trailing spaces, or multiple spaces
不含有换行符,回车符,制表符,头尾空格,或重复空格的字符串

Restrictions on String Data Types
对字符串数据类型的约束(Restrictions on String Data Types)

Restrictions that can be used with String data types:
可约束的字符串数据类型:

enumeration
列举

length
长度

maxLength
最大长度

minLength
最小长度

pattern (NMTOKENS, IDREFS, and ENTITIES cannot use this constraint)
式样(不能约束NMTOKENS, IDREFS,和 ENTITIES)

whiteSpace
空白
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: