Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

AS3.0¼ÓÔØÍⲿXMLÎļþ

¼ÓÔØÍⲿµÄXMLÎļþ£¬ÎļþÃûÊÇ1.xml;
<?xml version="1.0" encoding="utf-8"?>
<website>
<name a="Ãû×Ö1">ÖÜС´¨1</name>
<name a="Ãû×Ö2">ÖÜС´¨2</name>
<name a="Ãû×Ö3">ÖÜС´¨3</name>
<name a="Ãû×Ö4">ÖÜС´¨4</name>
<name a="Ãû×Ö5">ÖÜС´¨5</name>
</website>
ÔÚͬһĿ¼ÏÂÌí¼ÓAS3.0½Å±¾ÓïÑÔ
 package {
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.MovieClip;
import flash.system.System;
public class Xml extends MovieClip {
var myXML:XML;
var XML_URL:String;
var myXMLURL:URLRequest;
var myLoader:URLLoader;
var my_Array:Array;
public function Xml():void {
System.useCodePage=true;
myXML = new XML();
XML_URL = "1.xml";
myXMLURL = new URLRequest(XML_URL);
myLoader = new URLLoader(myXMLURL);
my_Array = new Array();
myLoader.addEventListener(Event.COMPLETE, xmlLoaded);
}
function xmlLoaded(event:Event):void {
myXML = XML(myLoader.data);
for (var i:Number = 0; i<myXML.name.length(); i++) {
my_Array[i] = myXML.name[i];
trace(my_Array[i]);
}
trace(myXML.name.@a+"\n");
trace("Data loaded.");
}
}
}


Ïà¹ØÎĵµ£º

¹ØÓÚÀûÓÃcmarkupÀཫxmlת³ÉÊ÷µÄµÝ¹é´úÂë

½üÀ´×Ô¼ºÔÚ×öxmlµÄ½âÎöÆ÷¡£ÀûÓõ½ÁËcmarkupÀ࣬¾Íµ±×ö´æ´¢°É£¡ÓÐÐèÒªµÄÅóÓÑ¿ÉÒÔÃ鼸ÑÛ¡£
HTREEITEM itemTemp1,itemTemp2;
 CString str1,str2;
 char strtemp[100];
 static bool result = true;
  strtemp[0] = 0;
  if (result)
  {
   xml.FindElem();
  }
&nbs ......

C#ÖÐÓÃSYSTEM.XML¶ÁдXML˵Ã÷Óë´úÂë

<?xml version="1.0" encoding="utf-8"?>
<LinkLibrary xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Link Cat="aa" Url="aa" Desc="aa" />
<Link Cat="bb" Url="aa" Desc="aa" />
<Link Cat="cc" Url="aa" Desc="aa" />
&l ......

Сë¿xml³õ²½ÊÔÑé

  XmlDocument xmldoc = new XmlDocument();//´´½¨xmlÎĵµ¶ÔÏó
        XmlNode root;//¸ù½Úµã
        xmldoc.Load(Server.MapPath("address.xml"));//¼ÓÔØxmlÎĵµ
        root = xmldoc.DocumentEle ......

Сë¿xml¶ÁÊé±Ê¼Ç

1.Èç¹ûÐèÒªÔÚÓ¦ÓóÌÐòÖд¦ÀíxmlÊý¾Ý£¬Ê×ÏÈÒª´´½¨1¸öXmlDocument¶ÔÏó£¬È»ºóͨ¹ýload·½·¨´ÓxmlÊý¾ÝÔ´ÖмÓÔضÔÏó¡£
2.xmlÖеÄÊý¾ÝÖ÷Òª±íÏÖΪԪËغÍÊôÐÔÁ½ÖÖÐÎʽ¡£
3.¶ÁÈ¡ÔªËØ
¶ÁÈ¡ÔªËØ¿Éͨ¹ýij½ÚµãµÄChildNodesÊôÐÔ»ñÈ¡Æä×ӽڵ㼯ºÏ£¬È»ºó¸ù¾Ý½ÚµãµÄNodeTypeÊôÐÔÈ·¶¨´Ë½ÚµãÊÇ·ñÊôÓÚÔªËؽڵ㡣ԪËؽڵãµÄÃû³Æ¿Éͨ¹ýNameÊôÐÔ» ......

VC½âÎöXML ʹÓÃCMarkupÀà½âÎöXML


  ÎÒÊÇʹÓõÄCMarkupÀà¶ÔXML½øÐвÙ×÷¡£        
         CMarkupºÃÏó¶¼ÊÇÏÈ´ÓÒ»¸öxmlÎļþÀïÃæ°ÑÄÚÈݶÁ³öÀ´£¬ÔÙ½øÐнâÎö£¬¸ãµÃÎÒºÞ²»µÃÒª°ÑÎÒµÄCStringдµ½xmlÎļþÀïÃæÔÙÈ¡³öÀ´ÁË¡£
         ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ