XML Schema °ïÖúÎĵµ4
XML Schema import ÔªËØ
¶¨ÒåºÍÓ÷¨
import ÔªËØÓÃÓÚÏòÒ»¸öÎĵµÌí¼Ó´øÓв»Í¬Ä¿±êÃüÃû¿Õ¼äµÄ¶à¸ö schema¡£
ÔªËØÐÅÏ¢
³öÏÖ´ÎÊý
ÎÞÏÞÖÆ
¸¸ÔªËØ
schema
ÄÚÈÝ
annotation
Óï·¨
<import
id=ID
namespace=anyURI
schemaLocation=anyURI
any attributes
>
(annotation?)
</import>
ÊôÐÔ
ÃèÊö
id
¿ÉÑ¡¡£¹æ¶¨¸ÃÔªËصÄΨһµÄ ID¡£
namespace
±ØÐè¡£¹æ¶¨Òªµ¼ÈëµÄÃüÃû¿Õ¼äµÄ URI¡£
schemaLocation
¿ÉÑ¡¡£¹æ¶¨±»µ¼ÈëµÄÃüÃû¿Õ¼äµÄ URI¡£
any attributes
¿ÉÑ¡¡£¹æ¶¨´øÓÐ non-schema ÃüÃû¿Õ¼äµÄÈκÎÆäËûÊôÐÔ¡£
£¨? ·ûºÅÉùÃ÷ÔÚ import ÔªËØÖУ¬¸ÃÔªËؿɳöÏÖÁã´Î»òÒ»´Î¡££©
ʵÀý
ÏÂÃæµÄÀý×Óչʾµ¼ÈëÒ»¸öÃüÃû¿Õ¼ä£º
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.w3school.com.cn/schema"/>
..
..
..
</xs:schema>
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>
XML&
Ïà¹ØÎĵµ£º
C#¶ÁÈ¡XML×ÊÁÏ
Ò» C#¶ÁÈ¡XML×ÊÁÏ
À©³ä±ê¼ÇÓïÑÔXML£¨eXtensible Markup Language£©£¬ÊÇÓÉWÈýC»ú¹ØÖƶ©µÄ¡£×öΪÓÃÒÔ´úÌæHTMLÓïÑÔµÄÒ»ÖÖÐÂʽµÄ±ê¼ÇÓïÑÔ£¬XMLÄÚ²¿ÓÐןܶà¸ù±¾»ù×¼£¬XMLÄËÊǾ¹ýÓëÕâЩÏà¸É»ù×¼µØ×éºÏ£¬Ó¦ÓÃÓÚ¿Æѧ¼ÆËã¡¢µç×Ó³ö°æ¡¢¶àýÌåϵÌåÀý×÷ºÍµç×ÓÉÌÎñµÄ¡£C££×÷ΪһÖÖÐÂʽµÄ³ÌÐòÓïÑÔ£¬ÊÇ.Net¹¹¼ÜµÄÒ»¸öÖ ......
<?xml version="1.0" encoding="UTF-8"?>
<root>
<person id="1">
<username >xiaoma</username>
<password>xiaoma</password>
</person>
<person id="2">
<username>manager</username> ......
¿ÉÄÜÄúÒѾÌý˵ÁË£¬±¾ÖÜÊÇ Microsoft ÊÂÒµ²¿ºÜ¹Ø¼üµÄÒ»ÖÜ¡£ÔÚ±¾ÖÜÔçЩʱºò£¬ÎÒÃÇÐû²¼½«¹«¿ª·¢ÐÐ Microsoft Office 2010 Beta¡£ÄúÊÇ·ñÔøÏ£ÍûÓëÍŶÓÒ»ÆðÔÚ Word Öй²Í¬´´×÷Ò»·ÝÎĵµ£¿ÄúÊÇ·ñÔøÏ£ÍûÔÚ Excel ÖÐͬʱ·ÖÎö³É¶ÑµÄÊý¾Ý£¿»òÕßÔÚ PowerPoint ÑÝʾÎĸåÖÐÍ»ÆƶàýÌåµÄÏÞÖÆ£¿ÄÇô£¬¸Ï¿ìÊÔÊÔ Beta °æ±¾°É¡£
¶ÔÓÚ±ê×¼ÉçÇø£ ......
[ÕªÒª]¿ÉÀ©Õ¹±êÖ¾ÓïÑÔ£¨¼ò³ÆXML£©ÔÚʵÏÖÐÅÏ¢±ê×¼»¯¡¢ÐÅÏ¢µÄ½»Á÷Óë¹²ÏíÉÏÓÐÆä¶ÀÌصļ¼ÊõÓÅÊÆ£¬Òò´ËËüÊܵ½Á˹㷺µÄÖØÊÓ¡£È«ÎÄÊ×ÏÈÌá³öÁË»ùÓÚXMLµÄÈý²ãClient/ServerÄ£ÐÍ£»È»ºó¶ÔÆä´ÓÊý¾Ý»ñÈ¡¡¢´«ÊäÖÁÏÔʾÒÔ¼°Íⲿ´¦ÀíµÄÓ¦ÓýøÐзÖÎö£»½Ó×ÅÒÔͼÊé×ÊÁϹÜÀíϵͳΪÀý£¬ËµÃ÷ÁËÆä¾ßÌåµÄʵÏÖ£»×îºó¶Ô»ùÓÚXMLµÄÈý²ãC/SÄ£ÐÍÔÚÐÅÏ¢±ê×¼» ......
XML Schema annotation ÔªËØ
¶¨ÒåºÍÓ÷¨
annotation ÔªËØÊÇÒ»¸ö¶¥²ãÔªËØ£¬¹æ¶¨ schema µÄ×¢ÊÍ¡£
×¢ÊÍ£º¿ÉÒÔ°üº¬ appinfo ÔªËØ£¨ÓÉÓ¦ÓóÌÐòʹÓõÄÐÅÏ¢£©ºÍ documentation ÔªËØ£¨ÓÉÓû§¶ÁÈ¡»òʹÓõÄ×¢ÊÍ»òÎı¾£©¡£
ÔªËØÐÅÏ¢
씀˵Ã÷
³öÏÖ´ÎÊý
ÔÚ¸¸ÔªËØÖÐÒ»´Î¡£
......