[¼¼Êõѧϰ]XML DTD ÈëÃÅ
XML DTD ÈëÃÅ(2009-12-14 09:08:49)
±êÇ©£ºÔÓ̸
DTDʵ¼ÊÉÏ¿ÉÒÔ¿´×÷Ò»¸ö»ò¶à¸öXMLÎļþµÄÄ£°å£¬ÕâЩXMLÎļþÖеÄÔªËØ¡¢ÔªËصÄÊôÐÔ¡¢ÔªËصÄÅÅÁз½Ê½/˳Ðò¡¢ÔªËØÄܹ»°üº¬µÄÄÚÈݵȣ¬¶¼±ØÐë·ûºÏDTDÖеĶ¨Òå¡£XMLÎļþÖеÄÔªËØ£¬¼´ÎÒÃÇËù´´½¨µÄ±ê¼Ç£¬ÊǸù¾ÝÎÒÃÇÓ¦ÓõÄʵ¼ÊÇé¿öÀ´´´½¨µÄ¡£ÏëÒª´´½¨Ò»·ÝÍêÕûÐԸߡ¢ÊÊÓ¦ÐÔ¹ãµÄDTDÊǷdz£À§Äѵģ¬ÒòΪ¸÷Ðи÷Òµ¶¼ÓÐËûÃÇ×Ô¼ºµÄÐÐÒµÌص㣬ËùÒÔDTDͨ³£ÊÇÒÔijÖÖÓ¦ÓÃÁìÓòΪ¶¨ÒåµÄ·¶Î§£¬È磺ҽѧ¡¢½¨Öþ¡¢¹¤ÉÌ¡¢ÐÐÕþ¡£DTD¶¨ÒåµÄÔªËغ¬¸Ç·¶Î§Ô½¹ã·º£¬ÄÇô¾ÍÔ½¸´ÔÓ¡£
DTD¿ÉÒÔÊÇÒ»¸öÍêÈ«¶ÀÁ¢µÄÎļþ£¬Ò²¿ÉÒÔÔÚXMLÎļþÖÐÖ±½ÓÉ趨¡£ËùÒÔ£¬ DTD·ÖΪÍⲿDTD£¨ÔÚXMLÎļþÖе÷ÓÃÁíÍâÒѾ±à¼ºÃµÄDTD£©ºÍÄÚ²¿DTD£¨ÔÚXMLÎļþÖÐÖ±½ÓÉ趨DTD£©Á½ÖÖ¡£±ÈÈ磬Óм¸Ê®¼ÒÏ໥ÁªÏµµÄ¡¢ºÏ×÷»ï°é¹ØϵµÄ¹«Ë¾¡¢³§ÉÌ£¬ËûÃÇÏ໥֮¼äµÄ½»»»µç×ÓÎĵµ¶¼ÊÇÓÃXMLÎĵµ¡£ÄÇôÎÒÃÇ¿ÉÒÔ½«ÕâЩXMLÎĵµµÄDTD·ÅÔÚij¸öµØ·½£¬ÈÃËùÓн»»»µÄXMLÎĵµ¶¼Ê¹ÓôËDTD£¬ÕâÊÇ×î·½±ãµÄ×ö·¨£¬Í¬Ê±Ò²ÊÊÓÃÓÚ¹«Ë¾ÄÚ²¿µÄXMLÎļþʹÓÃ.
ÄÚ²¿DTD
ÄÚ²¿DTDÊÇÔÚXMLÎļþµÄÎļþÐòÑÔÇøÓòÖж¨ÒåµÄ¡£Óï·¨£º
¡´!DOCTYPE element-name[........
]¡µ
¡´!DOCTYPE £º±íʾ¿ªÊ¼É趨DTD£¬×¢ÒâDOCUTYPEÊÇ´óд¡£
Element-name £ºÖ¸¶¨´ËDTDµÄ¸ùÔªËصÄÃû³Æ£¬Ò»¸öXMLÎļþÖ»ÄÜÓÐÒ»¸ö¸ùÔªËØ¡£×¢Ò⣬Èç¹û XMLÎļþʹÓÃÁËDTD£¬ÄÇôÎļþÖеĸùÔªËؾÍÔÚÕâÀïÖ¸¶¨¡£
[.........]¡µ £ºÔÚ[ ]±ê¼ÇÀïÃ涨ÒåXMLÎļþʹÓÃÔªËØ£¬È»ºóÓáµ½áÊøDTDµÄ¶¨Òå¡£
ÏÂÃ棬ÎÒÃÇÀ´¿´Ò»ÏÂÔõÑù¸øXMLÎļþ¶¨ÒåDTD£¬Çë¼ûÀý1¡£
Àý1ÖеÄDTD¶¨ÒåÇø¿ÉÒÔ¿´×÷ÊÇÒ»¸öDTD¶¨ÒåµÄ´ó¸Å¿ò¼Ü£¬ÎªÆäËûXMLÎļþ¶¨ÒåDTD£¬½á¹¹ºÍÀý1µÄDTD²î²»¶à£¬Ö»ÊÇ¿ÉÄÜÐèÒªÌí¼Ó¡¢É¾³ý»òÕ߸ü¸ÄһЩ¶«Î÷¶øÒÑ¡£ÔÚDTD¶¨ÒåµÄÖмäÊÇÔªËØÉ趨£¬ÕâÊÇÒ»¸öDTDµÄ×îÖ÷Òª²¿·Ö£¬ÆäÖ÷ÒªÓï·¨ÈçÏ£º
¡´!ELEMENT element-name element-definition¡µ
¡´!ELEMENT£º±íʾ¿ªÊ¼ÔªËØÉèÖã¬×¢Òâ´Ë´¦ELEMENT¹Ø¼ü×ÖÊÇ´óд¡£
element-name£º±íʾҪÉèÖõÄÔªËصÄÃû³Æ¡£
element-definition£ºÖ¸Ã÷Òª¶Ô´ËÔªËؽøÐÐÔõÑùµÄ¶¨Ò壬¾ÍÊÇ˵¡´ÔªËØ¡µ...¡´/ÔªËØ¡µÖ®¼äÄܹ»°üº¬Ê²Ã´ÄÚÈÝ£¬ÊÇÆäËûÔªËØ»¹ÊÇÒ»°ãÐÔµÄÎÄ×Ö¡£
ÔÚÀý1ÖУ¬´ó¼Ò¿ÉÒÔ¿´µ½£¬¡´!ELEMENT ²Î¿¼×ÊÁÏ (Êé¼®)¡µÕâ¸öÔªËØÉ趨ÊÇÉùÃ÷ÁË“²Î¿¼×ÊÁÏ”Õâ¸öÔªËØ£¬²¢ÇÒËüÊÇ×÷Ϊ“Êé¼®”Õâ¸öÔªËصĸ¸ÔªËØ¡£¡´!ELEMENT Êé¼® (Ãû³Æ,×÷Õß,¼
Ïà¹ØÎĵµ£º
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:XML id="xmlSource">
<node label="grandFather" state="unchecked">
<node label="Father" state="un ......
¸öÈËÊÕ¼¯¡¢ÕûÀíÁËһЩLINQ TO XMLµÄ»ù±¾·½·¨£¬Ï£Íû¸÷λ´óϺ¶à¶àÖ¸µ¼£º
/// <summary>
///Xml½ÚµãÊôÐÔ
/// </summary>
public class XmlAttribute
{
public XmlAttribute()
{
}
public XmlAttribute(string _key,object _value)
&nbs ......
3private XmlDocument xmlDoc;
4 //load xml file
5 private void LoadXml()
6 {
......
<?
/**
* xml2array() will convert the given XML text to an array in the XML structure.
* Link: http://www.bin-co.com/php/scripts/xml2array/
* Arguments : $contents - The XML text
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the ......
½ñÌì²ÅÖªµÀCMarkup¿ÉÒÔÖ±½Ó½âÎö×Ö·û´®ÐÎʽµÄXML¡£ÒÔÇ°¶¼ÊÇÏÈ´æÈëÒ»¸öÎļþ£¬È»ºó´ÓÎļþÖÐload¡£¶à×öÁËI/O²Ù×÷£¬Ð§Âʲ»¸ß¡£
CMarkup xml;
CString str;
xml.SetDoc(str);
tinyXmlÒ²¿ÉÒÔÖ±½Ó½âÎöXML×Ö·û´®£¬·½Ê½ÈçÏ£º
// directly parsing string with tinyxml
const char* ......