ÍøÂçѧԺ 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 ä¯ÀÀ:4043 :: ::

Date and time data types are used for values that contain date and time.
ÈÕÆÚºÍʱ¼äÊý¾ÝÀàÐÍÓÃÓÚ¶¨ÒåÈÕÆÚºÍʱ¼äÖµ¡£


Date Data Type
ÈÕÆÚÊý¾ÝÀàÐÍ

The date data type is used to specify a date.
ÈÕÆÚÊý¾ÝÀàÐÍÓÃÓÚÖ¸¶¨Ò»¸ö¾ßÌåµÄÈÕÆÚ¡£

The date is specified in the following form "YYYY-MM-DD" where:
ÈÕÆÚÓÉÏÂÃæµÄ"YYYY-MM-DD"ÐÎʽָ¶¨£º

  • YYYY indicates the year
    YYYY £ºÖ¸Ê¾Äê·Ý
  • MM indicates the month
    MM £ºÖ¸Ê¾Ô·Ý
  • DD indicates the day
    DD £ºÖ¸Ê¾ÈÕÆÚ

Note: All components are required!
×¢Ò⣺ËùÓÐ×é¼þ¶¼ÊDZØÒª×é¼þ¡£

The following is an example of a date declaration in a schema:
ÏÂÃæÊÇÒ»·ÝÔÚschemaÖÐÉùÃ÷Èͮ򵀡¸Àý£º

<xs:element name="start" type="xs:date"/>

An element in your document might look like this:
ÔÚÄãµÄÎĵµÖУ¬¿ÉÄܰüº¬ÕâÑùÒ»¸öÔªËØ£º

<start>2002-09-24</start>

Time Zones
ʱ¼äÇø

To specify a time zone, you can either enter a date in UTC time by adding a "Z" behind the date - like this:
ΪÁËÖ¸¶¨Ò»¸öʱ¼äÇø£¬Äã¼È¿ÉÒÔͨ¹ýÔÚÈÕÆÚÖ®ºó¼ÓÉÏ "Z" ·ÃÎÊ UTC ʱ¼ä¸ñʽµÄÈÕÆÚ£¬ÈçÏÂËùʾ£º

<start>2002-09-24Z</start>

or you can specify an offset from the UTC time by adding a positive or negative time behind the date - like this:
Ò²¿ÉÒÔÔÚ UTC ʱ¼äÖ®ºó¼Ó¡¢¼õÒ»¸öʱ¼äÖµ£¬ÈçÏÂËùʾ£º

<start>2002-09-24-06:00</start>
or
<start>2002-09-24+06:00</start>

 


Time Data Type
ʱ¼äÊý¾ÝÀàÐÍ

The time data type is used to specify a time.
ʱ¼äÊý¾ÝÀàÐÍÓÃÓÚÖ¸¶¨Ò»¸öʱ¼ä¡£

The time is specified in the following form "hh:mm:ss" where:
ʱ¼äÓÉÏÂÃæµÄ"hh:mm:ss"ÐÎʽָ¶¨£º

  • hh indicates the hour
    hh £ºÖ¸Ê¾Ð¡Ê±
  • mm indicates the minute
    mm £ºÖ¸Ê¾·ÖÖÓ
  • ss indicates the second
    ss £ºÖ¸Ê¾ÃëÖÓ

Note: All components are required!
×¢Ò⣺ËùÓеÄ×é¼þ¶¼ÊDZØÒª×é¼þ¡£

The following is an example of a time declaration in a schema:
ÏÂÃæÊÇÔÚschemaÄÚÉùÃ÷ʱ¼äµÄ°¸Àý£º

<xs:element name="start" type="xs:time"/>

An element in your document might look like this:
ÔÚÄãµÄÎĵµÖУ¬¿ÉÄܰüº¬ÏÂÊöÔªËØ£º

<start>09:00:00</start>

Or it might look like this:
»òÕßÊÇÕâÑùµÄ£º

<start>09:30:10.5</start>

Time Zones
ʱ¼äÇø

To specify a time zone, you can either enter a time in UTC time by adding a "Z" behind the time - like this:
ΪÁËÖ¸¶¨Ò»¸öʱ¼äÇø£¬Äã¼È¿ÉÒÔͨ¹ýÔÚʱ¼äÖ®ºó¼ÓÉÏ "Z" ·ÃÎÊ UTC ʱ¼ä¸ñʽµÄÈÕÆÚ£¬ÈçÏÂËùʾ£º

<start>09:30:10Z</start>

or you can specify an offset from the UTC time by adding a positive or negative time behind the time - like this:
Ò²¿ÉÒÔUTCʱ¼äºó¼Ó¡¢¼õÒ»¸öʱ¼äÖµ£¬ÈçÏÂËùʾ£º

<start>09:30:10-06:00</start>
or
<start>09:30:10+06:00</start>

 


DateTime Data Type
ÈÕÆÚʱ¼äÊý¾ÝÀàÐÍ

The dateTime data type is used to specify a date and a time.
ÈÕÆÚʱ¼äÊý¾ÝÀàÐÍÓÃÓÚÖ¸¶¨Ò»¸öÈÕÆÚÖµºÍÒ»¸öʱ¼äÖµ¡£

The dateTime is specified in the following form "YYYY-MM-DDThh:mm:ss" where:
ÈÕÆÚʱ¼äÓÉ"YYYY-MM-DDThh:mm:ss"µÄÐÎʽָ¶¨£º

  • YYYY indicates the year
    YYYY £ºÖ¸Ê¾Ê±¼ä
  • MM indicates the month
    MM £ºÖ¸Ê¾Ô·Ý
  • DD indicates the day
    DD £ºÖ¸Ê¾Ê±¼ä
  • T indicates the start of the required time section
    T ÓÃÓÚָʾʱ¼äÇøµÄ¿ªÍ·
  • hh indicates the hour
    hh £ºÖ¸Ê¾Ð¡Ê±
  • mm indicates the minute
    mm £ºÖ¸Ê¾·ÖÖÓ
  • ss indicates the second
    ss £ºÖ¸Ê¾ÃëÖÓ

Note: All components are required!
×¢Ò⣺ËùÓÐ×é¼þ¶¼ÊDZØÒª×é¼þ¡£

The following is an example of a dateTime declaration in a schema:
ÏÂÃæÁоÙÁËschemaÄÚµÄÈÕÆÚʱ¼äÉùÃ÷µÄ°¸Àý£º

<xs:element name="startdate" type="xs:dateTime"/>

An element in your document might look like this:
ÔÚÄãµÄÎĵµÖУ¬»òÐí°üº¬ÁËÏÂÊöÔªËØ£º

<startdate>2002-05-30T09:00:00</startdate>

Or it might look like this:
»òÕßÊÇÕâÑùµÄ£º

<startdate>2002-05-30T09:30:10.5</startdate>

Time Zones
ʱ¼äÇø

To specify a time zone, you can either enter a dateTime in UTC time by adding a "Z" behind the time - like this:
Ϊָ¶¨Ò»¸öʱ¼äÇø£¬Äã¼È¿ÉÒÔͨ¹ýÔÚʱ¼äµÄºóÃæ¼Ó¸ö "Z" ·ÃÎÊ UTC ʱ¼ä¸ñʽµÄÈÕÆÚ£¬ÈçÏÂËùʾ£º

<startdate>2002-05-30T09:30:10Z</startdate>

or you can specify an offset from the UTC time by adding a positive or negative time behind the time - like this:
Ò²¿ÉÒÔUTCʱ¼äºó¼Ó¡¢¼õÒ»¸öʱ¼äÖµ£¬ÈçÏÂËùʾ£º

<startdate>2002-05-30T09:30:10-06:00</startdate>
or
<startdate>2002-05-30T09:30:10+06:00</startdate>

 


Duration Data Type
³ÖÐøÊ±¼äÊý¾ÝÀàÐÍ£¨»ò“ʱ¼ä¶ÎÊý¾ÝÀàÐÍ”£©

The duration data type is used to specify a time interval.
³ÖÐøÊ±¼äÊý¾ÝÀàÐÍ£¨»ò“ʱ¼ä¶ÎÊý¾ÝÀàÐÍ”£©ÓÃÓÚ¶¨ÒåÒ»¶Îʱ¼ä¼ä¸ô¡£

The time interval is specified in the following form "PnYnMnDTnHnMnS" where:
ʱ¼ä¼ä¸ôÊÇÓÉ"PnYnMnDTnHnMnS"ÐÎʽ¶¨ÒåµÄ£¬½âÊÍÈçÏ£º

  • P indicates the period (required)
    P £ºÖ¸Ê¾ÖÜÆÚ£¨±ØÒª²ÎÊý£©
  • nY indicates the number of years
    nY £ºÖ¸Ê¾ÄêÊý
  • nM indicates the number of months
    nM £ºÖ¸Ê¾ÔÂÊý
  • nD indicates the number of days
    nD £ºÖ¸Ê¾ÌìÊý
  • T indicates the start of a time section (required if you are going to specify hours, minutes, or seconds)
    T £ºÖ¸Ê¾Ê±¼äƬ¶ÏµÄ¿ªÍ·£¨Èç¹ûÄãÐèÒªÖ¸¶¨Ê±¼ä¡¢·ÖÖÓ»òÃ룬¾Í±ØÐëʹÓÃT£©
  • nH indicates the number of hours
    nH £ºÖ¸Ê¾Ð¡Ê±Êý
  • nM indicates the number of minutes
    nM £ºÖ¸Ê¾·ÖÖÓÊý
  • nS indicates the number of seconds
    nS £ºÖ¸Ê¾ÃëÊý

The following is an example of a duration declaration in a schema:
ÏÂÃæÊÇschemaÄÚµÄʱ¼ä¶ÎÉùÃ÷µÄ°¸Àý£º

<xs:element name="period" type="xs:duration"/>

An element in your document might look like this:
ÔÚÄãµÄÎĵµÖлòÐí°üº¬ÏÂÊöÔªËØ£º

<period>P5Y</period>

The example above indicates a period of five years.
ÉÏÊö°¸ÀýÖ¸¶¨ÁË5ÄêµÄʱ¼ä¶Î£º

Or it might look like this:
»òÕßÒ²¿ÉÒÔÏñÕâÑù£º

<period>P5Y2M10D</period>

The example above indicates a period of five years, two months, and 10 days.
ÉÏÊö°¸ÀýÖ¸¶¨ÁË5Äê2¸öÔÂÁã10ÌìµÄʱ¼ä¶Î¡£

Or it might look like this:
ËüÒ²¿ÉÒÔÊÇÕâÑù£º

<period>P5Y2M10DT15H</period>

The example above indicates a period of five years, two months, 10 days, and 15 hours.
ÉÏÊö°¸ÀýÖ¸¶¨ÁË5Äê2¸öÔÂÁã10ÌìÓÖ15¸öСʱµÄʱ¼ä¶Î¡£

Or it might look like this:
»òÕßËü¿ÉÒÔÊÇÕâÑù£º

<period>PT15H</period>

The example above indicates a period of 15 hours.
ÉÏÊö°¸ÀýÖ¸¶¨ÁË15¸öСʱµÄʱ¼ä¶Î¡£

Negative Duration
¸ºÊ±¼ä¶Î

To specify a negative duration, enter a minus sign before the P:
Èç¹ûÒª¶¨Ò帺ʱ¼ä¶Î£¬ÄǾÍÐèÒªÔÚP֮ǰÌí¼ÓÒ»¸ö¸ººÅ£º

<period>-P10D</period>

The example above indicates a period of minus 10 days.
ÉÏÊö°¸ÀýÖ¸¶¨Á˸º10ÌìµÄʱ¼ä¶Î¡£


Date and Time Data Types
ÈÕÆÚºÍʱ¼äÊý¾ÝÀàÐÍ

Name
Ãû³Æ
Description
½âÊÍ
date Defines a date value
¶¨ÒåÈÕÆÚÖµ
dateTime Defines a date and time value
¶¨ÒåÈÕÆÚÖµºÍʱ¼äÖµ
duration Defines a time interval
¶¨Òåʱ¼ä¼ä¸ô
gDay Defines a part of a date - the day (DD)
¶¨ÒåÈÕÆÚµÄÒ»²¿·Ö——ÈÕ£ºday (DD)
gMonth Defines a part of a date - the month (MM)
¶¨ÒåÈÕÆÚµÄÒ»²¿·Ö——Ô£ºmonth (MM)
gMonthDay Defines a part of a date - the month and day (MM-DD)
¶¨ÒåÈÕÆÚµÄÒ»²¿·Ö——ÔºÍÈÕ£ºmonth and day (MM-DD)
gYear Defines a part of a date - the year (YYYY)
¶¨ÒåÈÕÆÚµÄÒ»²¿·Ö—— Ä꣺year (YYYY)
gYearMonth Defines a part of a date - the year and month (YYYY-MM)
¶¨ÒåÁËÈÕÆÚµÄÒ»²¿·Ö—— ÄêºÍÔ£º year and month (YYYY-MM)
time Defines a time value
¶¨Òåʱ¼äÖµ

 


Restrictions on Date Data Types
¶ÔÈÕÆÚÊý¾ÝÀàÐ͵ÄÔ¼Êø

Restrictions that can be used with Date data types:
¿ÉÔ¼ÊøµÄÈÕÆÚÊý¾ÝÀàÐÍÈçÏÂËùʾ£º

  • enumeration
    ÁоÙ
  • maxExclusive
    ³ýÈ¥×î´óÖµ
  • maxInclusive
    °üÀ¨×î´óÖµ
  • minExclusive
    ³ýÈ¥×îСֵ
  • minInclusive
    °üÀ¨×îСֵ
  • pattern
    ʽÑù
  • whiteSpace
    ¿Õ°×

ÆÀÂÛ (0) All