XML Schema redefine ÔªËØ
¶¨ÒåºÍÓ÷¨
redefine ÔªËØÔÊÐíÔÚµ±Ç° Schema ÖÐÖØÐ¶¨Òå´ÓÍⲿ¼Ü¹¹ÎļþÖлñÈ¡µÄ¼òµ¥ºÍ¸´ÔÓÀàÐÍ¡¢×éºÍÊôÐÔ×é¡£
ÔªËØÐÅÏ¢
³öÏÖ´ÎÊý | ÎÞÏÞÖÆ |
¸¸ÔªËØ | schema |
ÄÚÈÝ | annotation¡¢attributeGroup¡¢complexType¡¢group¡¢simpleType |
Óï·¨
<redefine id=ID schemaLocation=anyURI any attributes > (annotation|(simpleType|complexType|group|attributeGroup))* </redefine>
ÊôÐÔ | ÃèÊö |
---|---|
id | ¿ÉÑ¡¡£¹æ¶¨¸ÃÔªËØµÄΨһµÄ ID¡£ |
schemaLocation | ±ØÐè¡£¶Ô schema ÎĵµÎ»ÖÃµÄ URI ÒýÓᣠ|
any attributes | ¿ÉÑ¡¡£¹æ¶¨´øÓÐ non-schema ÃüÃû¿Õ¼äµÄÈÎºÎÆäËûÊôÐÔ¡£ |
ʵÀý
Àý×Ó 1
ÏÂÃæµÄÀý×ÓչʾÁËÒ»¸ö schema£¬Myschama2.xsd£¬ÆäÖдæÔÚÓÉ Myschama1.xsd ¹æ¶¨µÄÔªËØ¡£pname ÀàÐͱ»ÖØÐ¶¨Òå¡£¸ù¾Ý´Ë schema£¬±» pname Ô¼ÊøµÄÔªËØ±ØÐëÒÔ "country" ÔªËØ½áÊø£º
Myschema1.xsd:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="pname"> <xs:sequence> <xs:element name="firstname"/> <xs:element name="lastname"/> </xs:sequence> </xs:complexType> <xs:element name="customer" type="pname"/> </xs:schema>
Myschema2.xsd:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:redefine schemaLocation="Myschema1.xsd"> <xs:complexType name="pname"> <xs:complexContent> <xs:extension base="pname"> <xs:sequence> <xs:element name="country"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="author" type="pname"/> </xs:schema>