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

[ת]Android¶ÁдXML£¨ÉÏ£©——package˵Ã÷

--±¾ÎÄÕª×Ôhttp://www.moandroid.com/?p=508
By: º£ÊÐò×Â¥ | In: Android¿ª·¢
3 ¾Å 2009
XML ¾­³£ÓÃ×÷ Internet ÉϵÄÒ»ÖÖÊý¾Ý¸ñʽ£¬ÆäÎļþ¸ñʽÏë±Ø´ó¼Ò¶¼±È½ÏÇå³þ£¬ÔÚÕâÀïÎÒ½áºÏAndroidƽ̨£¬À´ËµÃ÷Android SDKÌṩµÄ¶ÁдXMLµÄpackage¡£
Ê×ÏȽéÉÜÏÂAndroid SDKÓëJava SDKÔÚ¶ÁдXMLÎļþ·½Ã棬Êý¾Ý°üÖ®¼äµÄ¹Øϵ¡£Android ƽ̨×î´óµÄÒ»¸öÓÅÊÆÔÚÓÚËüÀûÓÃÁË Java ±à³ÌÓïÑÔ¡£Android SDK ²¢Î´Ïò±ê×¼ Java Runtime Environment (JRE) ÌṩһÇпÉÓù¦ÄÜ£¬µ«ËüÖ§³ÖÆäÖкܴóÒ»²¿·Ö¹¦ÄÜ¡£Java ƽ̨֧³Öͨ¹ýÐí¶à²»Í¬µÄ·½Ê½À´Ê¹Óà XML£¬²¢ÇÒ´ó¶àÊýÓë XML Ïà¹ØµÄ Java API ÔÚ Android Éϵõ½ÁËÍêÈ«Ö§³Ö¡£¾ÙÀýÀ´Ëµ£¬Java µÄ Simple API for XML (SAX) ºÍ Document Object Model (DOM) ÔÚ Android É϶¼ÊÇ¿ÉÓõģ¬ÕâЩ API ¶àÄêÒÔÀ´Ò»Ö±¶¼ÊÇ Java ¼¼ÊõµÄÒ»²¿·Ö£¬½ÏÐ嵀 Streaming API for XML (StAX) ÔÚ Android Öв¢²»¿ÉÓᣵ«ÊÇ£¬ Android ÌṩÁËÒ»¸ö¹¦ÄÜÏ൱µÄ¿â¡£×îºó£¬Java XML Binding API ÔÚ Android ÖÐÒ²²»¿ÉÓã¬Õâ¸ö API ÒÑÈ·¶¨¿ÉÒÔÔÚ Android ÖÐʵÏÖ¡£Android SDKÌṩÁËÈçÏÂpackageÀ´Ö§³ÖXMLµÄ¶Áд£º
°ü
¹¦ÄܽéÉÜ
javax.xml
¸ù¾Ý XML ¹æ·¶¶¨ÒåºËÐÄ XML ³£Á¿ºÍ¹¦ÄÜ¡£
javax.xml.parsers
ÌṩDOMºÍSAX·½·¨½âÎöXMLÎĵµ
org.w3c.dom
W3CÌṩµÄʹÓÃDOM·½·¨¶ÁÈ¡XML
org.xml.sax
ÌṩºËÐÄSAX  APIs
org.xmlpull.v1
 
¶îÍâ²¹³ä˵Ã÷Ï£¬ÔÚandroid.utilÊý¾Ý°üÖÐÒ²ÌṩÁËÒ»¸öÀàXml£¬²»¹ýÕâ¸öÀà¾ÍÊÇ°ÑÒÔÉÏpackage¼òµ¥·â×°ÁËÏ¡£
¶ÁÈ¡XMLÖ÷ÒªÓÐ2ÖÖ·½·¨£ºDOMÓëSAX(Simple API for XML)£¬ÔÚÕâÀï¶ÔÕâ2ÖÖ·½·¨·Ö±ð¼ÓÒÔ˵Ã÷¡£
DOM(Îĵµ¶ÔÏóÄ£ÐÍ)£¬ÎªXMLÎĵµµÄ½âÎö¶¨ÒåÁËÒ»×é½Ó¿Ú£¬½âÎöÆ÷¶ÁÈëÕû¸öÎĵµ£¬È»ºó¹¹ÔìÒ»¸öפÁôÄÚ´æµÄÊ÷½á¹¹£¬È»ºó´úÂë¾Í¿ÉÒÔʹÓÃDOM½Ó¿ÚÀ´²Ù×éÕû¸öÊ÷½á¹¹£¬ÆäËûµãÈçÏ£º
Óŵ㣺Õû¸öÎĵµÊ÷¶¼ÔÚÄÚ´æµ±ÖУ¬±ãÓÚ²Ù×÷£»Ö§³Öɾ³ý¡¢Ð޸ġ¢ÖØÐÂÅÅÁеȶ๦ÄÜ¡£
ȱµã£º½«Õû¸öÎĵµµ÷ÈëÄڴ棨¾­³£°üº¬´óÁ¿ÎÞÓõĽڵ㣩£¬ÀË·Ñʱ¼äºÍ¿Õ¼ä¡£
ʹÓó¡ºÏ£ºÒ»µ©½âÎöÁËÎĵµ»¹ÐèÒª¶à´Î·ÃÎÊÕâЩÊý¾Ý£¬¶øÇÒ×ÊÔ´±È½Ï³ä×㣨ÈçÄÚ´æ¡¢CPUµÈ£©¡£
ΪÁ˽â¾öDOM½âÎöXMLÒýÆðµÄÕâЩÎÊÌ⣬³öÏÖÁËSAX¡£SAX½âÎöXMLÎĵµÎªÊ¼þÇý¶¯£¬Ïêϸ˵Ã÷ÇëÔĶÁAndroid¶ÁдXML£¨ÖУ©–SAX¡£µ±½âÎöÆ÷·¢ÏÖÔªËØ¿ªÊ¼¡¢ÔªËؽáÊø£¬Îı¾¡¢ÎĵµµÄ¿ªÊ¼»òÕß½áÊøʱ£¬·¢ËÍʼþ£¬ÔÚ³ÌÐòÖбàдÏìÓ¦ÕâЩʼþµÄ´úÂ룬ÆäÌصãÈçÏ£º
Óŵ㣺²»ÓÃÊÂÏȵ÷ÈëÕû¸öÎĵµ£¬Õ¼ÓÃ×ÊÔ´ÉÙ¡£ÓÈÆäÔ


Ïà¹ØÎĵµ£º

ÅжÏÊÇ·ñXMLÎĵµ

xhtmlµÄê¼»¨Ò»ÏÖ´øÀ´²»ÉÙÎÊÌ⣬ËüµÄÄ¿µÄÊÇÈÃhtml±íÏֵøüÏñxml£¬ËùÒԲŽÐxhtml¡£µ«Êdzöʦδ½ÝÉíÏÈËÀ£¬ÎÒÃÇÌÖÂÛÒ»ÏÂÈçºÎÅж¨ÎĵµÊÇXML°É¡£
Ó¡ÏóÖÐjQuery¶Ô´Ë·½·¨Öظ´ÊµÏÖÁËÐí¶à´Î£¬Ó¦¸Ã±È½ÏȨÍþ£¬Ò²ËµÃ÷ÕâÅж¨±È½ÏÄѸ㡣¿´jQuery1.42µÄʵÏÖ£º
var isXML = function(elem){
// documentElement is verifi ......

ÓÃc¶ÁÈ¡XMLÎļþ

 
¡¡ ¿ÉÒÔ½«XMLÎļþµÄÊ÷(Ö»ÓÐÒ»¸ö¶¥²ã½Úµã).ÓÚÊÇÀíËùµ±È»µÄ¿ÉÒÔÓÃÊ÷×÷ΪXMLµÄÒ»ÖÖ´æ´¢½á¹¹.
ÎÒ½«ÔÚÕâÀïÓÃC++ʵÏÖ¶Ô¼òµ¥µÄXMLÎļþµÄ½âÎö.
1.Ñ¡Ôñ´æ´¢½á¹¹:
Ê÷ÐÍÊý¾Ý½á¹¹ÓжàÖÖ´æ´¢·½Ê½,ÎÒ½«ÓÃ"º¢×ÓÐֵܱíʾ·¨",¶¨ÒåÈçÏÂ:
typedef struct CSNode
{
int subNodes;
string data;
string name;
struct CSNode *fi ......

»ùÓÚÓïÒåWeb¼¼ÊõµÄMISÓë»ùÓÚXML¼¼Êõ£¬´«Í³MISµÄ±È½Ï

ÕªÒª£ºÎÒÃÇÃèÊöÒ»¸ö¼òµ¥µÄÒµÎñϵͳµÄÓÃÀý£¬È»ºó½éÉܲ»Í¬µÄʵÏÖ¼¼Êõ¼°Æä±È½Ï¡£ÎÒûÓÐ×ö¹ýʵ¼ÊµÄ»ùÓÚSW¼¼ÊõµÄÐÅϢϵͳ£¬Òò´Ë±¾ÎÄÖ»ÊÇһЩ²ÂÏëÐԵĶ«
Î÷£¬Ï£ÍûÅ×שÒýÓñ£¬Äܵõ½´ó¼ÒµÄÖ¸½Ì,Ò²»¶Ó­´ó¼Ò²¹³ä£¬Ð»Ð»£¡
×¢ÒâÎÒÃÇÌÖÂ۵ĶÔÏóÊÇ´«Í³µÄMISϵͳ£¬ÈçͼÊé²éѯϵͳ£¬Ñ§Éú¹ÜÀíϵͳ֮ÀàµÄ¡£
ÓÃÀý£º Óû§ÔÚ²éѯ½çÃæÑ¡Ôñ ......

.netÖÐXMLÎļþ×÷ΪÊý¾ÝÔ´µÄ²Ù×÷Àà

²»½âÊÍÁË£¬×Ô¼º¿´´úÂë°É.......................
using System;
using System.Text;
using System.Data;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Xml;
namespace Gogofly.CommonOperation
{
 /// <summary>
 /// ......

phpÏÂͨ¹ýxml_parse½âÎöxmlÎļþ

xml_parse½âÎöxmlÎļþʱºò£¬
ºÜÓпÉÄܲ»½ö½öµ÷ÓÃÒ»´Îcharacter_handler¡£
ËùÒÔÔÚ»ñµÃxml½ÚµãµÄÎı¾ÐÅÏ¢µÄʱºò£¬ÒªÓÃÁ¬½ÓÔËËã".="¡£
²Î¿¼ http://jp2.php.net/manual/ro/function.xml-set-character-data-handler.php
ken at positive-edge dot com
30-Jan-2002
01:20
the function handler is called ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ