Symbianѧϰ±Ê¼Ç(15) ½âÎöXMLÎļþ(ÉÏ)
ÊÕ²Ø
ÎÒÔøÔÚÇ°Ãæ½éÉܹýÒ»¸ö¿ÉÓÃÓÚBREW»·¾³ÏµÄXML Parser£¬½ñÌìÏë·ÖÏíµÄÊÇÈçºÎÔÚSymbianƽ̨ÉϽâÎöXMLÎļþ£¬²»ÐèÒªµÚÈý·½µÄ¶«Î÷£¬SymbianÒѾΪÎÒÃÇÌṩÁËÕâ¸öÀàCParser¡£
ÍøÉÏÒ²ÓÐÕâ·½ÃæµÄ×ÊÁÏ£¬½¨Òé²Î¿¼£º
http://wiki.forum.nokia.com/index.php/How_to_parse_XML_file_using_CParser_class
²»¹ý£¬Òª×¢ÒâµÄÊÇSymbianÖеÄCParserÊÇ»ùÓÚSAX·½Ê½À´½âÎöµÄÒ²¾ÍÊÇ˵ËüÊÇ»ùÓÚʼþÁ÷·½Ê½£¬¶ÔÓÚSAX£¬Èç¹û×ö¹ýJAVA¿ª·¢µÄÒ»°ã²»»áÄ°ÉúÁË¡£ÓëDOMÏà±ÈSAX·½Ê½ÔÚ²Ù×÷ÉÏ»áÓеãÂé·³¶øÇÒÏÔµÃûÄÇôºÃÀí½â¡£
¼òÒª±È½Ïһϰɣ¬DOMÊǽ«XMLÔÚÄÚ´æÖÐÕ¹¿ª³ÉÒ»¸öÊ÷µÄÄ£ÐÍ£¬ÎÒÃÇ¿ÉÒÔ·½±ãµØ·ÃÎÊËüµÄÿ¸ö×ӽڵ㣬¿É¶Á¿Éд¡£µ«ÊÇSAXÄØ£¿ÎÒÃÇÖ»ÄÜͨ¹ýÒ»¸öµ¥ÏòÎı¾Á÷È¥½âÎöXML£¬ÔÚ¹ý³ÌÖÐÓжà¸öʼþ»Øµ÷£¨¿ªÊ¼Ä³¸öÔªËØ´¦Àí¡¢½áÊøij¸öÔªËØ´¦ÀíµÈµÈ£©£¬ËüÊǵ¥ÏòÖ»¶ÁµÄ¡£
ÏÂÃæÎÒÃÇÀ´Ïêϸ˵Ã÷Ò»ÏÂÈçºÎʵÏÖ°É¡£
Ê×ÏÈ£¬ÎÒÃǽ¨Á¢Ò»¸ö½âÎöÆ÷ÅÉÉúÓÚCActive£¬ÓÉËü¸ºÔðÕû¸ö½âÎö¹ý³Ì£¨ÒòΪÕâÊÇÒ»¸öÒì²½²Ù×÷£©¡£
#include <xmlparser.h>
#include <xmlcontenthandler.h>
using namespace Xml;
class MXMLHandlerObserver
...{
public:
virtual void OnParseCompleted( TInt aError ) = 0;
};
class CXMLActiveParser : public CActive ...{
public:
~CXMLActiveParser();
static CXMLActiveParser* NewL(MXMLHandlerObserver& aObserver,MContentHandler& aHandler);
static CXMLActiveParser* NewLC(MXMLHandlerObserver& aObserver,MContentHandler& aHandler);
public:
void StartL(const TDesC& aFileName);
private:
CXMLActiveParser(MXMLHandlerObserver& aObserver,MContentHandler& aHandler);
void ConstructL();
private:
void RunL();
void DoCancel();
TInt RunError(TInt aError);
private:
CParser* iParser;
HBufC8* iBuffer;
RFile  
Ïà¹ØÎĵµ£º
ÏÂÃæµÄ±í¸ñÁгöÁË°üº¬ÔÚDOM Level 1Öеķ½·¨£¬²¢Áгö²»Í¬µÄä¯ÀÀÆ÷ÊÇ·ñÖ§³ÖÏî¡£
·½ ·¨
Ãè Êö
IE
MOZ
OP
SAF
createAttribute
(name
)
Óøø¶¨Ãû³Æname
´´½¨ÌØÐÔ½Úµã
×
×
×
£
createCDATASection
(text
)
Óðüº¬Îı¾
text
µÄÎı¾×Ó½Úµã
´´½ ......
Êý¾Ý¿âÓ¦ÓÃϵͳ°üÀ¨Êý¾Ý¿â£¬Êý¾Ý¿â¹ÜÀíϵͳ£¬Êý¾Ý¿âÓ¦ÓÃÈý´ó²¿·Ö¡£
ÊÀ½çÉÏ´æÔÚÐí¶àÍêÈ«²»Í¬µÄ¿Í»§Æ½Ì¨£¬ÔÚ²»Í¬Æ½Ì¨¼ä½»»»Êý¾Ý£¬ÐèÒª±£Ö¤Êý¾ÝµÄÍêÕûºÍ·þÎñµÄ¸ßЧ£¬Êý¾Ý¸ñʽµÄת»»ÎÊÌâÍùÍù³ÉΪÖÆÔ¼Web ServiceµÄÆ¿¾±£¬²ÉÓÃXML×÷ΪÊý¾Ý½»»»µÄ±ê×¼£¬¿ÉÒÔʹ¸÷¸öÒ칹ƽ̨ºÍ¸÷ÖÖ¸ñʽµÄÊý¾Ý½øÐÐÊý¾Ý½»»»³ÉΪ¿ÉÄÜ¡£
......
³ö´¦£ºhttp://www.dimuthu.org/blog/2008/08/18/xml-schema-nillabletrue-vs-minoccurs0/
¡¾Ç°ÑÔ¡¿Ò»¸öÔÂÇ°Ñо¿¹ýnillable="true"ºÍ vs minOccurs="0"µÄÇø·Ö£¬Ã»ÓÐÏëµ½°¡£¬½ñÌì¾Í¼Ç²»µÃÁË£¬¿´À´ÕæÊǺüÇÐÔ²»ÈçÀñÊÍ·°¡£¬¿öÇÒÎÒ»¹Ã´µÄºÃ¼ÇÐÔ¡£¡£¡£¡£
¡¾×ܽ᡿ӢÎÄÒ»ÑÛ¿´²»³ö½áÂÛ£¬ËµµãººÓïÖ±½ÓЩ£¬±ð˵ÎÒÍÁ¹þ~
nillable=" ......
µÚÒ»²½:½«XML±à¼Æ÷ÉèÖÃĬÈÏΪMyeclipse edit
window__Preferences__General____Editors_____File Associations
ÕÒµ½*.xml,Ñ¡ÔñMyeclipse Xml editor,µãdefault
µÚ¶þ²½:ÅäÖÃdtd»òÕßxsdÎļþ
Window → Preferences... → MyEclipse → Files & Editors → ......
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(NetShop.Config.DbConfigs.GetSitePath + "images/flashdata/flash.config"));
DataRow[] drs = ds.Tables[0].Select("", "[SortOrder] ASC");
//·µ»ØµÄÊǸöDataRow[]£º
//DataR ......