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

An empty complex element cannot have contents, only attributes.
Ò»¸ö¿ÕµÄ¸´ºÏÔªËØ²»Äܰüº¬ÄÚÈÝ£¬Ö»Äܰüº¬ÊôÐÔ¡£


Complex Empty Elements
¸´ºÏ¿ÕÔªËØ

An empty XML element:
Ò»¸ö¿ÕµÄXMLÔªËØÈçÏ£º

<product prodid="1345" />

The "product" element above has no content at all. To define a type with no content, we must define a type that allows only elements in its content, but we do not actually declare any elements, like this:
ÉÏÊö"product"ÔªËØÍêÈ«²»°üº¬ÈκÎÄÚÈÝ¡£ÎªÁ˶¨Òå²»°üº¬ÄÚÈݵÄÀàÐÍ£¬ÎÒÃDZØÐ붨ÒåÒ»¸öÄÚÈÝÖÐÖ»ÔÊÐí³öÏÖÔªËØµÄÀàÐÍ¡£µ«ÊÇ£¬ÎÒÃDz»ÐèÒªÉùÃ÷ÈκÎÔªËØ£¬ÈçÏÂËùʾ£º

<xs:element name="product">

<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:integer">
<xs:attribute name="prodid" type="xs:positiveInteger"/>

</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>

In the example above, we define a complex type with a complex content. The complexContent element signals that we intend to restrict or extend the content model of a complex type, and the restriction of integer declares one attribute but does not introduce any element content.
ÔÚÉÏÊö°¸ÀýÖУ¬ÎÒÃǶ¨ÒåÁËÒ»¸ö°üº¬¸´ºÏÄÚÈݵĸ´ºÏÀàÐÍ¡£¸´ºÏÄÚÈݵÄÔªËØÖ¸Ã÷ÁËÎÒÃÇÏëÒªÔ¼Êø»òÀ©³äµÄ¸´ºÏÀàÐ͵ÄÄÚÈÝģʽ£¬²¢¶ÔÕûÊýµÄÔ¼ÊøÌõ¼þÉùÃ÷ÁËÒ»¸öÊôÐÔ£¬µ«²»°üº¬¶ÔÔªËØÄÚÈݵĽéÉÜ¡£

However, it is possible to declare the "product" element more compactly, like this:
È»¶ø£¬ÎÒÃÇ»¹¿ÉÒÔ¸ü¼Ó¼ò½àµØÉùÃ÷"product"ÔªËØ£¬ÈçÏÂËùʾ£º

<xs:element name="product">
<xs:complexType>

<xs:attribute name="prodid" type="xs:positiveInteger"/>
</xs:complexType>
</xs:element>

Or you can give the complexType element a name, and let the "product" element have a type attribute that refers to the name of the complexType (if you use this method, several elements can refer to the same complex type):
»òÕßÄã¿ÉÒÔ¸øcomplexTypeÔªËØÆð¸öÃû³Æ£¬²¢Ê¹"product"ÔªËØ°üº¬Ò»¸öÀàÐÍÊôÐÔ£¬²¢ÇÒ£¬ÀàÐÍÊôÐÔÒýÓõÄÊÇcomplexTypeµÄÃû³Æ£¨Èç¹ûÄãʹÓÃÕâ¸ö·½·¨£¬ÄÇô£¬¼¸¸öÔªËØ¾Í¿ÉÒÔÒýÓÃÏàͬµÄ¸´ºÏÀàÐÍ£©£º

<xs:element name="product" type="prodtype"/>
<xs:complexType name="prodtype">
<xs:attribute name="prodid" type="xs:positiveInteger"/>
</xs:complexType>

ÆÀÂÛ (0) All