ʹÓÃXMLList¶ÁÈ¡XMLÊý¾Ý
ʹÓÃXMLList¶ÁÈ¡XMLÊý¾Ý
¡¡¡¡XML¶ÔÏóÌṩÁËÒ»¸ö·µ»ØXMLListÀàÐ͵ķ½·¨elements()£¬¼È·µ»ØËùÓÐXML¶ÔÏóµÄ×ÓÔªËؽڵ㣬ËæºóÎÒÃÇ¿ÉÒÔͨ¹ýfor eachÓï¾äÑ»·Ôò¿É·ÃÎʵ½Õû¸öXMLÊý¾ÝÄÚÈÝ¡£ÒÔÉÏÃæ´´½¨ÄÚ²¿XMLÎĵµµÄXMLÊý¾ÝΪÀý£¬Ïêϸ¼ûÈçÏ´úÂë¿é£º
varlist:XMLList=pXml.elements();
foreach(varelement:XMLinlist)
{
¡¡¡¡//»ñȡÿһ¸ö½ÚµãµÄid
¡¡¡¡Alert.show(element.@id);
¡¡¡¡trace(element.@id);
}
¡¡¡¡ÕâÀïÐèҪעÒâÒ»µã¾ÍÊÇelements()·½·¨Ö»»áµ±Ç°½ÚµãµÄÏÂÒ»¼¶½Úµã£¬Èç¹ûXML²ã´Î½á¹¹±È½Ï¶à»¹ÐèµÝ¹éÀ´´¦Àí¡£ÁíÍ⻹¿ÉÒÔʹÓÓ.”²Ù×÷·ûÀ´È¡Êý¾Ý£¬¸ñʽΪ£º¸ù½Úµã.×Ó½Úµã.....ÔªËØÃû³Æ;
Ïà¹ØÎĵµ£º
´ó¼Ò¶¼ÖªµÀÔÚSQL ServerÖÐÀûÓà FOR XML PATH Óï¾äÄܹ»°Ñ²éѯµÄÊý¾ÝÉú³ÉXMLÊý¾Ý£¬ÏÂÃæÊÇËüµÄһЩӦÓÃʾÀý¡£
DECLARE @TempTable table(UserID int , UserName nvarchar(50));
insert into @TempTable (UserID,UserName) values (1,'a')
insert into @TempTable (UserID,UserName) values (2,'b')
select UserID, ......
µ÷ÊÔʱ·¢ÏÖÈÕÖ¾±¨ÈçÏ´íÎó org.xml.sax.SAXParseException
·¢ÏÖÊÇxml¶ÔÌØÊâ·ûºÅÒª×ö´¦Àí£¬¼¸¸öÌØÊâ·ûºÅÈçÏ£º
< < СÓÚºÅ
> > ´óÓÚºÅ
& & ºÍ
' ' µ¥ÒýºÅ
" " Ë«ÒýºÅ
ÔÚxmlÖаÑÌØÊâ·ûºÅÓÃÉÏÊöתϼ´ºÃÁË ......
Ç°¶Îʱ¼ä¸ø¿Í»§×öÁ˼¸¸öÍøÒ³£¬¿Í»§ÒªÇóÔÚ×Ô¼ºµÄÍøÕ¾ÖÐÏÔʾ×Ô¼ºÔÚÐÂÀ˲©¿ÍÀïµÄÎÄÕ£¬×÷ΪÍøÕ¾µÄÒ»²¿·Ö¡£ÕâÑùµÄÇé¿ö¿ÉÒÔ½â¾ö£¬Ö÷Òª¿ÉÒÔͨ¹ý²©¿ÍÖÐµÄ XMLÀ´ÊµÏÖ£¬Í¨¹ýÓÃaspÀ´¶ÁÈ¡²©¿ÍÖÐXML£¬½«²©¿ÍÖеıêÌâ¡¢·¢²¼Ê±¼äµÈÐÅÏ¢ÏÔʾÔÚÍøÕ¾ÖС£µ«ÊÇÔÚʹÓõĹý³ÌÖУ¬³öÏÖÁËÒ»¸öÎÊÌ⣺µ±²©¿ÍÖÐÌí¼ÓÎÄÕºó£¬ÔÚÍøÒ³ÖжÁÈ¡²©¿ÍÖеÄXMLºó½ ......
ÏÂÃæµÄÄÚÈÝ£¬ÎÒÃǽ«¸ü¶àµÄ¹Ø×¢DOM£¬ÎªDOM×÷Ò»¸ö½ÏΪÏêϸµÄ½âÎö£¬Ê¹ÎÒÃÇʹÓÃÆðÀ´¸üΪµÃÐÄÓ¦ÊÖ¡£
DOMÏê½â
1£®»ù±¾µÄDOM¶ÔÏó
DOMµÄ»ù±¾¶ÔÏóÓÐ5¸ö£ºDocument£¬Node£¬NodeList£¬ElementºÍAttr¡£ÏÂÃæ¾ÍÕâЩ¶ÔÏóµÄ¹¦ÄܺÍʵÏֵķ½·¨×÷Ò»¸ö´óÖµĽéÉÜ¡£
Document¶ÔÏó´ú±íÁËÕû¸öXMLµÄÎĵµ£¬ËùÓÐÆäËüµÄNode£¬¶¼ÒÔÒ»¶¨µÄ˳Ðò°üº ......
DOM³õ²½
DOMÊÇDocument Object ModelµÄËõд£¬¼´Îĵµ¶ÔÏóÄ£ÐÍ¡£Ç°Ãæ˵¹ý£¬XML½«Êý¾Ý×é֯Ϊһ¿ÅÊ÷£¬ËùÒÔDOM¾ÍÊǶÔÕâ¿ÅÊ÷µÄÒ»¸ö¶ÔÏóÃèÐð¡£Í¨Ë×µÄ˵£¬¾ÍÊÇͨ¹ý½âÎöXMLÎĵµ£¬ÎªXMLÎĵµÔÚÂß¼ÉϽ¨Á¢Ò»¸öÊ÷Ä£ÐÍ£¬Ê÷µÄ½ÚµãÊÇÒ»¸ö¸ö¶ÔÏó¡£ÎÒÃÇͨ¹ý´æÈ¡ÕâЩ¶ÔÏó¾ÍÄܹ»´æÈ¡XMLÎĵµµÄÄÚÈÝ¡£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬¿´¿´ÔÚDOMÖ ......