XML Schema include ÔªËØ

¶¨ÒåºÍÓ÷¨

include ÔªËØÓÃÓÚÏòÒ»¸öÎĵµÌí¼Ó´øÓÐÏàͬĿ±êÃüÃû¿Õ¼äµÄ¶à¸ö schema¡£

ÔªËØÐÅÏ¢

³öÏÖ´ÎÊý ÎÞÏÞÖÆ
¸¸ÔªËØ schema
ÄÚÈÝ annotation

Óï·¨

<include
id=ID
schemaLocation=anyURI
any attributes
>

(annotation?)

</include>
ÊôÐÔ ÃèÊö
id ¿ÉÑ¡¡£¹æ¶¨¸ÃÔªËØµÄΨһµÄ ID¡£
schemaLocation ±ØÐè¡£¹æ¶¨ÔÚ°üº¬ schema µÄÄ¿±êÃüÃû¿Õ¼äÖУ¬Òª°üÀ¨µÄ schema µÄ URI¡£
any attributes ¿ÉÑ¡¡£¹æ¶¨´øÓÐ non-schema ÃüÃû¿Õ¼äµÄÈÎºÎÆäËûÊôÐÔ¡£

£¨? ·ûºÅÉùÃ÷ÔÚ include ÔªËØÖУ¬¸ÃÔªËØ¿É³öÏÖÁã´Î»òÒ»´Î¡££©

ʵÀý

ͨ¹ý±»°üÀ¨µÄ schema£¬±»°üÀ¨µÄÎļþ±ØÐëÈ«²¿ÒýÓÃÏàͬµÄÄ¿±êÃüÃû¿Õ¼ä¡£Èç¹û schema Ä¿±êÃüÃû¿Õ¼ä²»Æ¥Å䣬Ôò°üÀ¨²»»áÓÐЧ£º

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3school.com.cn/schema">

<xs:include schemaLocation="http://www.w3school.com.cn/schema/customer.xsd"/>
<xs:include schemaLocation="http://www.w3school.com.cn/schema/company.xsd"/>

..

..

..

</xs:schema>
VUE