XML Schema ²Î¿¼ÊÖ²á1
XML Schema ²Î¿¼ÊÖ²á
XSD ÔªËØ
ÔªËØ
½âÊÍ
all
¹æ¶¨×ÓÔªËØÄܹ»ÒÔÈÎÒâ˳Ðò³öÏÖ£¬Ã¿¸ö×ÓÔªËؿɳöÏÖÁã´Î»òÒ»´Î¡£
annotation
annotation ÔªËØÊÇÒ»¸ö¶¥²ãÔªËØ£¬¹æ¶¨ schema µÄ×¢ÊÍ¡£
any
ʹ´´×÷Õß¿ÉÒÔͨ¹ýδ±» schema ¹æ¶¨µÄÔªËØÀ´À©Õ¹ XML Îĵµ¡£
anyAttribute
ʹ´´×÷Õß¿ÉÒÔͨ¹ýδ±» schema ¹æ¶¨µÄÊôÐÔÀ´À©Õ¹ XML Îĵµ¡£
appInfo
¹æ¶¨ annotation ÔªËØÖÐÓ¦ÓóÌÐòҪʹÓõÄÐÅÏ¢¡£
attribute
¶¨ÒåÒ»¸öÊôÐÔ¡£
attributeGroup
¶¨ÒåÔÚ¸´ÔÓÀàÐͶ¨ÒåÖÐʹÓõÄÊôÐÔ×é¡£
choice
½öÔÊÐíÔÚ <choice> ÉùÃ÷Öаüº¬Ò»¸öÔªËسöÏÖÔÚ°üº¬ÔªËØÖС£
complexContent
¶¨Òå¶Ô¸´ÔÓÀàÐÍ£¨°üº¬»ìºÏÄÚÈÝ»ò½ö°üº¬ÔªËØ£©µÄÀ©Õ¹»òÏÞÖÆ¡£
complexType
¶¨Ò帴ÔÓÀàÐÍ¡£
documentation
¶¨Òå schema ÖеÄÎı¾×¢ÊÍ¡£
element
¶¨ÒåÔªËØ¡£
extension
À©Õ¹ÒÑÓÐµÄ simpleType »ò complexType ÔªËØ¡£
field
¹æ¶¨ XPath ±í´ïʽ£¬¸Ã±í´ïʽ¹æ¶¨ÓÃÓÚ¶¨Òå±êʶԼÊøµÄÖµ¡£
group
¶¨ÒåÔÚ¸´ÔÓÀàÐͶ¨ÒåÖÐʹÓõÄÔªËØ×é¡£
import
ÏòÒ»¸öÎĵµÌí¼Ó´øÓв»Í¬Ä¿±êÃüÃû¿Õ¼äµÄ¶à¸ö schema¡£
include
ÏòÒ»¸öÎĵµÌí¼Ó´øÓÐÏàͬĿ±êÃüÃû¿Õ¼äµÄ¶à¸ö schema¡£
key
Ö¸¶¨ÊôÐÔ»òÔªËØÖµ£¨»òÒ»×éÖµ£©±ØÐëÊÇÖ¸¶¨·¶Î§Äڵļü¡£
keyref
¹æ¶¨ÊôÐÔ»òÔªËØÖµ£¨»òÒ»×éÖµ£©¶ÔÓ¦Ö¸¶¨µÄ key »ò unique ÔªËصÄÖµ¡£
list
°Ñ¼òµ¥ÀàÐͶ¨ÒåΪָ¶¨Êý¾ÝÀàÐ͵ÄÖµµÄÒ»¸öÁÐ±í¡£
notation
ÃèÊö XML ÎĵµÖÐ·Ç XML Êý¾ÝµÄ¸ñʽ¡£
redefine
ÖØж¨Òå´ÓÍⲿ¼Ü¹¹ÎļþÖлñÈ¡µÄ¼òµ¥ºÍ¸´ÔÓÀàÐÍ¡¢×éºÍÊôÐÔ×é¡£
restriction
¶¨Òå¶Ô simpleType¡¢simpleContent »ò complexContent µÄÔ¼Êø¡£
schema
¶¨Òå schema µÄ¸ùÔªËØ¡£
selector
Ö¸¶¨ XPath ±í´ïʽ£¬¸Ã±í´ïʽΪ±êʶԼÊøÑ¡ÔñÒ»×éÔªËØ¡£
sequence
ÒªÇó×ÓÔªËرØÐ밴˳Ðò³öÏÖ¡£Ã¿¸ö×ÓÔªËؿɳöÏÖ 0 µ½ÈÎÒâ´ÎÊý¡£
simpleContent
°üº¬¶Ô complexType ÔªËصÄÀ©Õ¹»òÏÞÖÆÇÒ²»°üº¬ÈκÎÔªËØ¡£
simpleType
¶¨ÒåÒ»¸ö¼òµ¥ÀàÐÍ£¬¹æ¶¨Ô¼ÊøÒÔ¼°¹ØÓÚÊôÐÔ»ò½öº¬Îı¾µÄÔªËصÄÖµµÄÐÅÏ¢¡£
union
¶¨Òå¶à¸ö simpleType ¶¨ÒåµÄ¼¯ºÏ¡£
unique
Ö¸¶¨ÊôÐÔ»òÔªËØÖµ£¨»òÕßÊôÐÔ»òÔªËØÖµµÄ×éºÏ£©ÔÚÖ¸¶¨·¶Î§ÄÚ±ØÐë
Ïà¹ØÎĵµ£º
ÔÚ×öÒ»°ãµÄXMLÊý¾Ý½»»»¹ý³ÌÖУ¬ÎÒ¸üÀÖÒâ´«µÝXML×Ö·û´®£¬¶ø²»ÊǸñʽ»¯µÄXML Document¡£Õâ¾ÍÉæ¼°µ½XML×Ö·û´®ºÍXml DocumentµÄת»»ÎÊÌ⣬˵°×ÁËÕâÊǸöºÜ¼òµ¥µÄÎÊÌ⣬±¾Îľ͸÷ÖÖXML½âÎöÆ÷·Ö±ðÁоÙÈçÏ£¬ÒÔ·½±ã×Ô¼º½ñºó²éÔÄ¡£
Ò»¡¢Ê¹ÓÃ×îÔʼµÄjavax.xml.parsers£¬±ê×¼µÄjdk api
// ×Ö·û´®×ªXML
String xmlStr = "......";
S ......
<?xml version="1.0" encoding="UTF-8"?>
<root>
<person id="1">
<username >xiaoma</username>
<password>xiaoma</password>
</person>
<person id="2">
<username>manager</username> ......
//¶ÁÈ¡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£©ÔÚʵÏÖÐÅÏ¢±ê×¼»¯¡¢ÐÅÏ¢µÄ½»Á÷Óë¹²ÏíÉÏÓÐÆä¶ÀÌصļ¼ÊõÓÅÊÆ£¬Òò´ËËüÊܵ½Á˹㷺µÄÖØÊÓ¡£È«ÎÄÊ×ÏÈÌá³öÁË»ùÓÚXMLµÄÈý²ãClient/ServerÄ£ÐÍ£»È»ºó¶ÔÆä´ÓÊý¾Ý»ñÈ¡¡¢´«ÊäÖÁÏÔʾÒÔ¼°Íⲿ´¦ÀíµÄÓ¦ÓýøÐзÖÎö£»½Ó×ÅÒÔͼÊé×ÊÁϹÜÀíϵͳΪÀý£¬ËµÃ÷ÁËÆä¾ßÌåµÄʵÏÖ£»×îºó¶Ô»ùÓÚXMLµÄÈý²ãC/SÄ£ÐÍÔÚÐÅÏ¢±ê×¼» ......
protected void Button1_Click(object sender, EventArgs e)
{
//Ϊresponse(star)½Úµã ºÍ Cabins(f) cabin½Úµã·Ö±ðÌí¼Ó¸ö
&nbs ......