XMLÎĵµÊ¹ÓõÄÊÇ×ÔÃèÊöµÄºÍ¼òµ¥µÄÓï·¨£¬Ò»¸öXMLÎĵµ×î»ù±¾µÄ¹¹³É°üÀ¨£ºÉùÃ÷£¬´¦ÀíÖ¸Á¿ÉÑ¡£©ºÍÔªËØ¡£ÒÔÏÂÊÇÒ»¸ö¼òµ¥µÄXMLÎĵµ£º 1<?xml version ="1.0" encoding ="GB2312" standalone="yes" ?>
2<?XML-stylesheet type="text/xsl" href="yxfqust.xsl" ?>
3<!--ÒÔÏÂÊÇÒ»¸öѧÉúÃûµ¥-->
4<ѧÉúÃûµ¥>
5 <ѧÉú>
6 <ѧºÅ>2003081205</ѧºÅ>
7 <ÐÕÃû>ÌïÁÜ</ÐÕÃû>
8 <°à¼¶>¼Æ03.2°à</°à¼¶>
9 </ѧÉú>
10 <ѧÉú>
11 <ѧºÅ>2003081232</ѧºÅ>
12 <ÐÕÃû>ÑîÑ©·æ</ÐÕÃû>
13 <°à¼¶>¼Æ03.2°à</°à¼¶>
14 </ѧÉú>
15</ѧÉúÃûµ¥>µÚ1ÐÐÊÇXMLÉùÃ÷£¬µÚ2ÐÐÊÇ´¦ÀíÖ¸ÁµÚ3ÐÐÊÇ×¢ÊÍ£¬4µ½15¾ÍÊÇÎĵµµÄ¸÷¸öÔªËØ¡££¨×¢£ºXML±ê¼Ç¶¼ÊÇ´óСдÃô¸ÐµÄ).
Ò»¡£ÎĵµµÄÉùÃ÷£º
<?XML version="1.0" encoding="GB2312" standalone="yes"?>
XML±ê¼Ç˵Ã÷ËüÊÇÒ»¸öxmlÎĵµ£¬ºóÃæÁ½¸öÊôÐÔÖµ±íÃ÷ÁËËüµÄ°æ±¾ºÅºÍ±àÂë±ê×¼£¬standaloneÈ¡yes±íÃ÷¸ÃÎļþδÒýÃ÷ÆäËûÍⲿXMLÎļþ¡£
¶þ¡£´¦ÀíÖ¸Áî
¸ñʽ£º<?´¦ÀíÖ¸ÁîÃû ´¦ÀíÖ¸ÁîÐÅÏ¢ £¿> <?XML-stylesheet type="text/xsl" href="yxfqust.xsl" ?>Èý¡£×¢ÊÍ£º
¸ñʽ£º<!--×¢ÊÍÄÚÈÝ-->
<!--ÒÔÏÂÊÇÒ»¸öѧÉúÃûµ¥-->×¢ÊÍӦעÒâµÄÎÊÌ⣺
1.×¢ÊͲ»ÄܳöÏÖÔÚXMLÉùÃ÷֮ǰ£»
2.×¢ÊͲ»ÄܳöÏÖÔÚ±ê¼ÇÖУ»
3.×¢ÊÍÖв»ÄܳöÏÖÁ¬ÐøÁ½¸öÁ¬×Ö·û£¬¼´"££" È磺<!--this is a bad document.--do you know!-->£»
4.×¢ÊÍÖпɰüº¬ÔªËØ£¬µ«ÔªËØÖв»ÄÜ°üº¬"££"°üº¬µÄÔªËؽâÎöʱ±»ºöÂÔ£»
5.×¢ÊͲ»ÄÜǶÌ×£»
ËÄ¡£ÔªËØÓë±ê¼Ç£º
ËùÓеÄXMLÔªËرØÐëºÏÀí°üº¬,ÇÒËùÓеÄXMLÎĵµ±ØÐëÓÐÒ»¸ö¸ùÔªËØ¡£ÈçͬHTMLÒ»Ñù£¬XMLÔªËØͬÑùÒ²¿ÉÒÔÓµÓÐÊôÐÔ¡£XMLÔªËصÄÊôÐÔÒÔÃû×Ö/Öµ³É¶ÔµÄ³öÏÖ¡£XMLÓï·¨¹æ·¶ÒªÇóXMLÔªËØÊôÐÔÖµ±ØÐëÓÃÒýºÅÒý×Å¡£Çë¿´ÏÂÃæµÄÁ½¸öÀý×Ó£¬µÚÒ»¸öÊÇ´íÎóµÄ£¬µÚ¶þ¸öÊÇÕýÈ·µÄ¡£
<?XML version="1.0" encoding="ISO-8859-1"?>
<note date=12/11/2002>
<to>Tove</to>
<from>Jani</from>
</note>
£££££££££££££££££££££££££££
<?XML version="1.0" encoding="ISO-8859-1"?>
<note date="12/11/2002">
<to>Tove</to>
<from>Jani</from>
</note>¸ñʽ£º<±ê¼Ç ÊôÐÔÃû1£½"Öµ1".......>Êý¾ÝÄÚÈÝ</±ê¼Ç>
XMLÔªËØÊÇ¿ÉÒÔÀ©Õ¹µÄ£¬ËüÃÇÖ®¼äÓйØÁª£¬XMLÔªËØÓмòµ¥µÄÃüÃû¹æÔò£º
Names can contain letters, numbers, and other characters £¨ÔªËصÄÃû×Ö¿ÉÒÔ°üº¬×Óĸ£¬Êý×ÖºÍÆäËû×Ö·û¡££©
Names must not start with a number or punctuation character £¨ÔªËصÄÃû×Ö²»ÄÜÒÔÊý×Ö»òÕß±êµã·ûºÅ¿ªÍ·¡££©
Names must not start with the letters XML (or XML or Xml ..) £¨ÔªËصÄÃû×Ö²»ÄÜÒÔXML(»òÕßxml£¬Xml,xMl...)¿ªÍ·¡££©
Names cannot contain spaces£¨ÔªËصÄÃû×Ö²»ÄÜ°üº¬¿Õ¸ñ¡££©
ÔªËØÊÇXMLÎĵµµÄÁé»ê£¬Ëü¹¹³ÉÁËÎĵµµÄÖ÷ÒªÄÚÈÝ¡£XMLÔªËØÔòÊÇÓɱê¼ÇÀ´¶¨ÒåµÄ£¬Í¬Ê±±ê¼Ç·ÖΪ·Ç¿Õ±ê¼ÇºÍ¿Õ±ê¼Ç¡£
1.·Ç¿Õ±ê¼Ç¸ñʽ£º
<±ê¼Ç>ÔªËØÄÚÈÝ</±ê¼Ç> È磺
<ѧºÅ>2003081205</ѧºÅ>
<ÐÕÃû>ÌïÁÜ</ÐÕÃû>
<°à¼¶>¼Æ03.2°à</°à¼¶>
2.¿Õ±ê¼Ç¸ñʽ£º
<±ê¼ÇÃû ÊôÐÔÃû£½"ÊôÐÔÖµ"£¬ ÊôÐÔÃû£½"ÊôÐÔÖµ"......> È磺<ÌïÁÜ Ñ§ºÅ£½"2003081205">
ͬʱԪËØÒ²Ö§³ÖºÏÀíµÄǶÌ×£¬ÈçÉÏÃæµÄÎĵµÀý×Ó£¬Ñ§ÉúÃûµ¥ÓëѧÉú¾ÍÊÇÒ»²ãǶÌס£Ç¶Ì×ÐèÂú×ãÒÔϹæÔò£º
1.ËùÓÐXMLÎĵµ¶¼´ÓÒ»¸ö¸ù½Úµã¿ªÊ¼£¬¸ù½Úµã°üº¬ÁËÒ»¸ö¸ùÔªËØ£»
2.ÎĵµÄÚËùÓÐÆäËûÔªËرØÐë°üº¬ÔÚ¸ùÔªËØÖÐ;
3.ǶÌ×ÔÚÄÚµÄΪ×ÓÔªËØ£¬Í¬Ò»²ãµÄ»¥ÎªÐÖµÜÔªËØ£»
4.×ÓÔªËØ»¹¿ÉÒÔ°üº¬×ÓÔªËØ£»
5.°üº¬×ÓÔªËصÄÔªËسÆΪ·ÖÖ§£¬Ã»ÓÐ×ÓÔªËصÄÔªËسÆΪÊ÷Ò¶£»
Êý¾Ý¼È¿ÉÒÔ´æ´¢ÔÚ×ÓÔªËØÖÐÒ²¿ÉÒÔ´æ´¢ÔÚÊôÐÔÖУ¬Ó¦¾¡Á¿Ê¹ÓÃ×ÓÔªËضø±ÜÃâʹÓÃÊôÐÔ¡£ÔÒòÈçÏ£º
attributes cannot contain multiple values (child elements can) (ÊôÐÔ²»ÄÜ°üº¬¶à¸öÖµ£¨×ÓÔªËØ¿ÉÒÔ))
attributes are not easily expandable (for future changes) (ÊôÐÔ²»ÈÝÒ×À©Õ¹)
attributes cannot describe structures (child elements can) (ÊôÐÔ²»Äܹ»ÃèÊö½á¹¹£¨×ÓÔªËØ¿ÉÒÔ£©)
attributes are more difficult to manipulate by program code (ÊôÐÔºÜÄѱ»³ÌÐò´úÂë´¦Àí)
attribute values are not easy to test against a Document Type Definition (DTD) - which is used to define the legal elements of an XML document(ÊôÐÔÖµºÜÄÑͨ¹ýDTD½øÐвâÊÔ)