XML,XMLList,XMLListCollectionÖ®¼äµÄ¹Øϵ±Ê¼Ç
ͨ³£Çé¿öÏ£¬Äã¿ÉÒÔ´Ó·þÎñÆ÷ÉÏΪtree¿Ø¼þÈ¡µÃXMLÊý¾Ý £¬ÄãÒ²¿ÉÒÔÔÚ<mx:Tree>TagÀïÖ±½Ó¶¨Òå¸ñʽÁ¼ºÃµÄXMLÊý¾Ý¡£
Äã¿ÉÒÔʹÓÃ<mx:XML>»òÕß<mx:XMLList>TagÔÚmxmlÀﶨÒåXMLÊý¾Ý¡£
Äã¿ÉÒÔ½«XML objectÖ±½Ó×÷Ϊһ¸ö²ã¼¶Êý¾Ý¿Ø¼þµÄdataProvider,however,if the object changes dynamically,ÄãÓ¦¸Ã×öÈçÏ´¦Àí£º
1£¬½«XML»òÕßXMLList objectsת»»ÎªXMLListCollection£»
2£¬Í¨¹ýÐÞ¸ÄXMLListCollectionÊý¾ÝÀ´¸üÐÂÔʼµÄXMLÊý¾Ý£»
XMLListCollectionÖ§³ÖIListºÍICollectionViewÁ½¸ö½Ó¿Ú£¬ËùÒÔËüÄÜʵÏÖaccess,sort,filterµÈµÈ²Ù×÷£º
get,set,add,remove
ͬʱ֧³ÖIViewCursor½Ó¿Ú£¬ÓÚÊÇ¿ÉÒÔʵÏÖCursor¹¦ÄÜ£º
Ò»¸öArray,ArrayCollection,ICollectionViewºÍIViewCursorÖ®¼äµÄ¹ØϵµÄÀý×ÓÈçÏ£º
var myAC:ArrayCollection=new ArrayCollection(myArray);
var myCursor:IViewCursor=myAC.CreateCursor();
while(!myCursor.afterLast){myCursor.moveNext();}
ÒÔÏÂÀý×ÓÏÔʾÁËÁ½¸öTree£¬Ò»¸öʹÓÃXML×÷ΪÊý¾ÝÔ´£¬Ò»¸öʹÓÃXMLListCollection×÷ΪÊý¾ÝÔ´
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:XML id="capitals">
<root>
<Capitals label="U.S. State Capitals">
<capital label="AL" value="Montgomery"/>
<capital label="AK" value="Juneau"/>
<capital label="AR" value="Little Rock"/>
<capital label="AZ" value="Phoenix"/>
</Capitals>
<Capitals label="Canadian Province Capitals"&
Ïà¹ØÎĵµ£º
Ò»£ºÉè¼Æģʽ²¿·Ö
״̬ģʽ£¨state£©
״̬ģʽÀàËÆÓÚÒ»ÖÖ¼òµ¥µÄ¹¤×÷Á÷£¬ÓÃÀ´°Ñ´óÁ¿µÄÅжϷÖÖ§½øÐвð·Ö£¬¸øÿһÖÖÅжÏÔö¼ÓÒ»¸ö״̬£¬Èç¹û²»Âú×ã¸ÃÅжϿÉÒÔ½øÐÐ״̬ת»»£¬ÖªµÀÓöµ½Âú×ãÌõ¼þΪֹ
ÕâÑù×öµÄºÃ´¦¾ÍÊÇ£¬µ±ÐèÒªÔö¼ÓÅжϵÄʱºò£¬²»ÐèÒª¸Ä±äÒѾ´æÔڵĴúÂë¡£Ö»ÐèÒªÔö¼ÓÅжϵÄÀ࣬ÔʼÅжÏÀàÖÐÔö¼ÓеÄ״̬ת»»¡£
Ê ......
XML ÐòÁл¯¿ÉÒÔ²ÉÓôӼòµ¥µ½¸´ÔӵĶàÖÖÐÎʽ¡£ÀýÈ磬¿ÉÒÔÐòÁл¯Ö»°üº¬¹«¹²×ֶκ͹«¹²ÊôÐÔµÄÀ࣬Èç XML ÐòÁл¯¼ò½éÖÐËùʾ¡£ÏÂÃæµÄ´úÂëʾÀýÌÖÂÛ¸÷Öָ߼¶·½°¸£¬°üÀ¨ÈçºÎʹÓà XML ÐòÁл¯Éú³É·ûºÏÌض¨ XML ¼Ü¹¹ (XSD) ÎĵµµÄ XML Á÷¡£
ÐòÁл¯Êý¾Ý¼¯
³ýÁËÐòÁл¯¹«¹²ÀàµÄʵÀýÍ⣬»¹¿ÉÐòÁл¯ DataSet µÄʵÀý£¬ÈçÏÂÃæµÄ´úÂëʾÀýËùʾ ......
Ç°¶Îʱ¼ä¸ø¿Í»§×öÁ˼¸¸öÍøÒ³£¬¿Í»§ÒªÇóÔÚ×Ô¼ºµÄÍøÕ¾ÖÐÏÔʾ×Ô¼ºÔÚÐÂÀ˲©¿ÍÀïµÄÎÄÕ£¬×÷ΪÍøÕ¾µÄÒ»²¿·Ö¡£ÕâÑùµÄÇé¿ö¿ÉÒÔ½â¾ö£¬Ö÷Òª¿ÉÒÔͨ¹ý²©¿ÍÖÐµÄ XMLÀ´ÊµÏÖ£¬Í¨¹ýÓÃaspÀ´¶ÁÈ¡²©¿ÍÖÐXML£¬½«²©¿ÍÖеıêÌâ¡¢·¢²¼Ê±¼äµÈÐÅÏ¢ÏÔʾÔÚÍøÕ¾ÖС£µ«ÊÇÔÚʹÓõĹý³ÌÖУ¬³öÏÖÁËÒ»¸öÎÊÌ⣺µ±²©¿ÍÖÐÌí¼ÓÎÄÕºó£¬ÔÚÍøÒ³ÖжÁÈ¡²©¿ÍÖеÄXMLºó½ ......
dom4j ÊÇÒ»ÖÖ½âÎö XML ÎĵµµÄ¿ª·ÅÔ´´úÂë XML ¿ò¼Ü¡£±¾ÎĽéÉÜÈçºÎʹÓðüº¬ÔÚ dom4j ÖеĽâÎöÆ÷´´½¨²¢ÐÞ¸Ä XML Îĵµ¡£
dom4j API °üº¬Ò»¸ö½âÎö XML ÎĵµµÄ¹¤¾ß¡£±¾ÎÄÖн«Ê¹ÓÃÕâ¸ö½âÎöÆ÷´´½¨Ò»¸öʾÀý XML Îĵµ¡£Çåµ¥ 1 ÏÔʾÁËÕâ¸öʾÀý XML Îĵµ£¬catalog.xml¡£
Çåµ¥ 1. ʾÀý XML Îĵµ£¨catalog.xml£©
<?xml version=" ......
DOM³õ²½
DOMÊÇDocument Object ModelµÄËõд£¬¼´Îĵµ¶ÔÏóÄ£ÐÍ¡£Ç°Ãæ˵¹ý£¬XML½«Êý¾Ý×é֯Ϊһ¿ÅÊ÷£¬ËùÒÔDOM¾ÍÊǶÔÕâ¿ÅÊ÷µÄÒ»¸ö¶ÔÏóÃèÐð¡£Í¨Ë×µÄ˵£¬¾ÍÊÇͨ¹ý½âÎöXMLÎĵµ£¬ÎªXMLÎĵµÔÚÂß¼ÉϽ¨Á¢Ò»¸öÊ÷Ä£ÐÍ£¬Ê÷µÄ½ÚµãÊÇÒ»¸ö¸ö¶ÔÏó¡£ÎÒÃÇͨ¹ý´æÈ¡ÕâЩ¶ÔÏó¾ÍÄܹ»´æÈ¡XMLÎĵµµÄÄÚÈÝ¡£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬¿´¿´ÔÚDOMÖ ......