w3pop.com :: ÍøÂçѧԺ :: Schema (XSD) :: 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:
¿ÉÔ¼ÊøµÄ×Ö·û´®Êý¾ÝÀàÐÍÈçÏ£º
ÆÀÂÛ (0)
All