ÔÚMFC³ÌÐòÖÐʹÓÃXMLÎļþÅäÖù¤¾ßÀ¸
ÔÚMFC³ÌÐòÖÐʹÓÃXMLÎļþÅäÖù¤¾ßÀ¸
×÷ÕߣºÖì½ð²Ó
À´Ô´£ºhttp://www.cnblogs.com/clever101
ÏÖÔÚÎÒ·¢ÏÖʹÓÃVisual StudioµÄ×ÊÔ´±à¼Æ÷½øÐбà¼×ÊÔ´ÓÐ×ÅÖî¶àµÄ²»±ã£ºÊ×ÏÈÊÇÈκÎ×ÊÔ´µÄ±ä¶¯Ò»°ã±ä¶¯´úÂ룬²»ÀûÓÚϵͳά»¤£¬Æä´ÎVisual StudioµÄ×ÊÔ´±à¼Æ÷µÄ±¾ÉíµÄ¹¦ÄÜÓÐÏÞ£¬Ò²²»ÀûÓÚ½çÃæÃÀ»¯£¬ÈýÊDz»ÀûÓÚÈËÔ±·Ö¹¤£¬¿ª·¢ÈËÔ±¼ÈҪæʵÏÖ¹¦ÄÜ£¬ÓÖҪæ׼±¸ºÃµÄ½çÃæËزġ£¶Ô½çÃæʵÏÖÎļþÅäÖû¯ÕýÊǽâ¾öÉÏÃæÎÊÌâµÄºÃ·½·¨¡£Õâ´ÎÎÒʵÏÖÁËʹÓÃXMLÎļþÅäÖù¤¾ßÀ¸¡£ÕâÀïËùνÅäÖþÍÊǹ¤¾ßÀ¸µÄ½çÃæÐÅÏ¢È繤¾ßÀ¸±êÌâ¡¢°´Å¥Í¼Æ¬¡¢ÊÇ·ñΪ·Ö¸ô·û¶¼ÔÚXMLÎļþ±£´æ£¬³ÌÐòͨ¹ý½âÎöXMLÎļþÀ´»ñÈ¡¹¤¾ßÀ¸ÐÅÏ¢À´´´½¨¹¤¾ßÀ¸¡£ÕâÑùÒ»µ©·¢ÏÖ½çÃæ²»ºÏÊÊ¿ÉÒÔËæʱÐÞ¸ÄÅäÖÃÎļþ£¬Í¬Ê±ÀûÓÚÈËÔ±·Ö¹¤¡£
¾ßÌåµÄ×ö·¨ÈçÏ£º
1. ÔÚ¹¤³ÌµÄÊä³öĿ¼ÏÂÓÐÒ»¸öSysConfig.xml£¬×÷ΪϵͳÅäÖÃÎļþ¡£ÆäÖйØÓÚ¹¤¾ßÀ¸µÄÅäÖò¿·ÖÈçÏ£º
<AppToolbar valid="1" caption="»ù´¡¹¤¾ß">
<ToolButton file="Add.bmp" />
<ToolButton separator="true" />
<ToolButton file="Benchmark.bmp" />
<ToolButton file="Comment.bmp" />
<ToolButton file="Convert.bmp" />
<ToolButton file="Delete.bmp" />
<ToolButton file="Exit.bmp" />
</AppToolbar>
¼òµ¥½âÊÍÒ»ÏÂÉÏÃæµÄ½ÚµãÒâÒ壺valid±íʾ¹¤¾ßÀ¸ÊÇ·ñÓÐЧ£¬caption±íʾ¹¤¾ßÀ¸±êÌ⣬file½ÚµãΪ¹¤¾ßÀ¸°´Å¥ËùÌùͼƬ£¬separator±íʾ°´Å¥ÊÇ·Ö¸ô·û¡£
2.  
Ïà¹ØÎĵµ£º
ÔÚJ2MEÌåϵÖУ¬¶ÔxmlµÄ½âÎöÓбȽÏÓÐÃûµÄµÚÈý·½½âÎöAPI£¬·Ö±ðΪKXMLºÍNanoXML£¬ËûÃǶ¼ÌṩÁ˶ԽâÎöxmlµÄÖ§³Ö¡£KXMLÔÚ½âÎöXML¹ý³ÌÖлá¶ÔÎļþÄÚÈÝÒ»²ãÒ»²ã½øÐнâÎö£¬Òò´Ë³ÉΪÔöÁ¿Ê½½âÎöÆ÷£¬±È½ÏÊʺϴóÎļþµÄ½âÎö¡£¶øNanoXMLÊÇÒ»´ÎÐÔ½âÎöÆ÷£¬ÔÚÒ»´Îʱ¼äÀï¾Í°ÑÕû¸öxmlÎĵµ½âÎöÍ꣬Òò´Ë²»ÊʺϴóÎļþµÄ½âÎö£¬»áÔì³ÉÄÚ´æ²»×ãµÄÏÖÏó¡ ......
×î½üдµÄ²å¼þÓõ½ÁËdom4j£¬À´¶Áд£¬ÐÞ¸ÄÎĵµ¡£Óõ½µÄ¹¦Äܶ¼Ð´³öÀ´ÁË
ÏÂÃæ°üº¬ÁËÁ½¸ö³ÌÐò WriteFriendsInfo£¬ºÍ ReadFriendsInfo¡£
1.WriteFriendsInfo °üº¬ÁËн¨xmlºÍÐ޸ģ¬É¾³ýxml½ÚµãµÄ·½·¨
һЩҪµã£º
WriteFriendsInfo ÖÐÐ޸Ľڵã²ÉÓõķ½Ê½ÊÇɾ³ý½Úµã£¬È»ºó°ÑеĽڵãд½øÈ¥¡£ÔÚ²»¶Ô¶Á ......
Ó¦Ò»¸öͬʵÄÒªÇó£¬ÒªÀûÓÃstrtusµÄAction½«Ò»¸öÊý¾Ý¿â±íµÄÊý¾ÝÊä³öΪxml¸ñʽµÄÊý¾Ý£¬·½±ãµ¼ÈëʹÓ᣾Ñо¿Action»¹ÕæÄÜ°ìµ½£¬Êµ¼ÊÉϲ»ÊÇActionµÄ¹¦ÀÍ£¬¶øÊÇJDOMµÄ¹¦ÀÍ£¬²»ËµÄÇô¶àÁË£¬¸ø´ó¼Ò·ÖÏíһϡ£ ÎÒÓÐÒ»¸ö²âÊÔ±í£¬ÓÐÁ½¸ö×ֶΣ¬Ò»¸öÊÇÓû§Ãû£¬Ò»¸öÊÇÃÜÂ룬ÏÖ½«Õ⸠......
protected void Page_Load(object sender, EventArgs e)
{
try
{
&nbs ......
XML DOM½éÉÜ
Ò»¡¢XML DOM¼ò½é
DOM£¨Document Object Model£¬Îĵµ¶ÔÏóÄ£ÐÍ£©ÊÇÒ»ÖÖÓ¦ÓóÌÐò½Ó¿Ú£¨API£©µÄÓ¦Óã¬Ëü½«Îĵµ£¨ÈçXMLÎĵµ£¬HTMLÎĵµµÈ£©¿´³ÉÊÇÒ»¸öÎĵµ¶ÔÏó£¬È»ºóͨ¹ý³ÌÐòÓïÑÔ£¨ÈçJavaScriptµÈ½Å±¾ÓïÑÔ£¬C++µÈ£©µ÷ÓøÃÎĵµ¶ÔÏ󣬶ÔÎĵµÖеÄÊý¾Ý½øÐдæÈ¡£¬²¢ÀûÓóÌÐò¶Ô»ñÈ¡µÄÊý¾Ý½øÐиú½øÒ»²½µÄ´¦Àí¡£
X ......