xml shema°ïÖúÎĵµ5
XML Schema union ÔªËØ
¶¨ÒåºÍÓ÷¨
union ÔªËØ¶¨Òå¶à¸ö simpleType ¶¨ÒåµÄ¼¯ºÏ¡£
ÔªËØÐÅÏ¢
³öÏÖ´ÎÊý
Ò»´Î
¸¸ÔªËØ
simpleType
ÄÚÈÝ
annotation¡¢simpleType
Óï·¨
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
£¨? ·ûºÅÉùÃ÷ÔÚ union ÔªËØÖиÃÔªËØ¿É³öÏÖÁã´Î»òÒ»´Î¡££©
ÊôÐÔ
ÃèÊö
id
¿ÉÑ¡¡£¹æ¶¨¸ÃÔªËØµÄΨһµÄ ID¡£
memberTypes
¿ÉÑ¡¡£¹æ¶¨ÔÚ schema Öж¨ÒåµÄÄÚÖÃÊý¾ÝÀàÐÍ»ò simpleType ÔªËØµÄÃû³ÆÁÐ±í¡£
any attributes
¿ÉÑ¡¡£¹æ¶¨´øÓÐ non-schema ÃüÃû¿Õ¼äµÄÈÎºÎÆäËûÊôÐÔ¡£
ʵÀý
Àý×Ó 1
±¾ÀýÊÇÒ»¸öºÏ²¢ÁËÁ½¸ö¼òµ¥ÀàÐ͵ļòµ¥ÀàÐÍ£º
<xs:element name="jeans_size">
<xs:simpleType>
<xs:union memberTypes="sizebyno sizebystring" />
</xs:simpleType>
</xs:element>
<xs:simpleType name="sizebyno">
<xs:restriction base="xs:positiveInteger">
<xs:maxInclusive value="42"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="sizebystring">
<xs:restriction base="xs:string">
<xs:enumeration value="small"/>
<xs:enumeration value="medium"/>
<xs:enumeration value="large"/>
</xs:restriction>
</xs:simpleType>
XML Schema unique ÔªËØ
¶¨ÒåºÍÓ÷¨
unique ÔªËØÖ¸¶¨ÊôÐÔ»òÔªËØÖµ£¨»òÕßÊôÐÔ»òÔªËØÖµµÄ×éºÏ£©ÔÚÖ¸¶¨·¶Î§ÄÚ±ØÐëÊÇΨһµÄ¡£ ¸ÃÖµ±ØÐëΨһ»òΪÁã¡£
unique ÔªËØ±ØÐ밴˳Ðò°üº¬ÏÂÁÐÔªËØ£º
selector ÔªËØ
selector ÔªËØ°üº¬ XPath ±í´ïʽ£¬Ö¸¶¨Ò»¸öÔªËØ¼¯£¬ÔÚÆäÖÐÓÉ field ÔªËØÖ¸¶¨µÄÖµ±ØÐëΨһ¡£
±ØÐëÓÐÒ»¸öÇÒÖ»ÓÐÒ»¸ö selector ÔªËØ¡£
field ÔªËØ
ÿһ¸ö field ÔªËØ¾ù°üº¬Ò»¸ö XPath ±í´ïʽ£¬Ö¸¶¨
Ïà¹ØÎĵµ£º
Õâ¸ö¶«Î÷¹¦Äܼܺòµ¥£¬Ã»ÓÐʲô¼¼Êõº¬Á¿¡£Ö»ÊǼǼһÏ¡£
xml µÄÊý¾Ý»ñÈ¡ºó£¬¿ÉÒÔͨ¹ýÒ»¸ö¼òµ¥·ÖÒ³´¦ÀíÀ´Íê³É¼òµ¥·ÖҳЧ¹û¡£
1.ÀûÓÃÇóÓàºÍ³ý·¨µÄ·½·¨ÅжÏÒ³Êý
Õâ¸öÊÇÒ»¸ö±È½Ï³£¼ûµÄ×ö·¨£¬Ò²ÊÇÒ»ÖÖ°ì·¨¡£ÔÚÕâÀ²»¶ÔÕâÖÖ·ÖÒ³´¦ÀíÒª´ïµ½Ê²Ã´×îÓÅ»¯µÄЧ¹û½øÐÐÌÖÂÛ£¬ÕâÀïÖ»ÊÇ̽ÌÖÒ»ÖÖ°ì·¨¡£¶ÔһР......
(Ò») ÏȽ²Ò»ÏÂXMLÖеÄÎïÊâ×Ö·û£¬ÊÖ¶¯ÌîдʱעÒâһϡ£
×Ö·û ×Ö·ûʵÌå
& ......
//¶ÁÈ¡XMLÎļþ
//1¡¢LoadfromFile×°ÈëXMLÎļþ
//2¡¢Ö¸¶¨Â·¾¶£¬¼¤»î¶ÁÈ¡
//3¡¢´ÓÄÚ´æÁ÷¶ÁÈ¡
//4¡¢´ÓÍøÂçÉÏÖ±½Ó»ñÈ¡
//1¡¢LoadfromFile×°ÈëXMLÎļþ
procedure TForm1.Button1Click(Sender: TObject);
begin
XMLDocument1.LoadfromFile('c:\temp\test.xml');
// XMLDocument1.Active := True;
Memo1.Lines := X ......
XML Schema attributeGroup ÔªËØ
¶¨ÒåºÍÓ÷¨
attributeGroup ÔªËØÓÃÓÚ¶ÔÊôÐÔÉùÃ÷½øÐÐ×éºÏ£¬ÕâÑùÕâЩÉùÃ÷¾ÍÄܹ»ÒÔ×éºÏµÄÐÎʽºÏ²¢µ½¸´ÔÓÀàÐÍÖС£
ÔªËØÐÅÏ¢
³öÏÖ´ÎÊý
ÎÞÏÞÖÆ
¸¸ÔªËØ
attributeGroup¡¢complexType¡¢schema¡¢restriction (simpleContent)¡¢extension (simpleContent)¡¢rest ......