ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: Schema (XSD) :: XSD ×Ö·û´®Êý¾ÝÀàÐÍ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

Schema (XSD)
Schema (XSD) ½éÉ..
ΪºÎʹÓà XML Sch..
ÈçºÎ¶¨ÖÆ XSD
XSD - <schema..
XSD ¼òµ¥ÔªËØ
XSD ÊôÐÔ
XSD Ô¼ÊøÃæ
XSD ¸´ºÏÔªËØ
XSD ¸´ºÏ¿ÕÔªËØ
XSD ¸´ºÏ´¿ÔªËØ
XSD ¸´ºÏ´¿Îı¾
XSD »ìºÏÄÚÈݵĸ´..
XSD ָʾÆ÷¸´ºÏÀà..
XSD <any> ..
XSD <anyAttri..
XSD ÔªËØÌæ´ú
XSD ʵÀý
XSD ×Ö·û´®Êý¾ÝÀà..
XSD ÈÕÆÚÊý¾ÝÀàÐÍ
XSD СÊýÊý¾ÝÀàÐÍ

XSD ×Ö·û´®Êý¾ÝÀàÐÍ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-29 ÐÞ¸Ä:2007-08-29 ä¯ÀÀ:4253 :: ::

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ÄÚÉùÃ÷·½·¨µÄ°¸Àý£º

<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
¹æ¸ñ»¯µÄ×Ö·û´®Êý¾ÝÀàÐÍ

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´¦ÀíÆ÷»áʹÓÿոñ·ûÌæ´úÖÆ±í·û¡£


Token Data Type
·ûºÅÊý¾ÝÀàÐÍ

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´¦ÀíÆ÷»áɾ³ýÖÆ±í·û¡£


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  
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 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
    ¿Õ°×

ÆÀÂÛ (0) All