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£¬ÔÚ¹ý³ÌÖÐÓжà¸öʼþ»Øµ÷£¨¿ªÊ¼Ä³¸öÔªËØ´¦Àí¡¢½áÊøÄ³¸öÔªËØ´¦ÀíµÈµÈ£©£¬ËüÊǵ¥ÏòÖ»¶ÁµÄ¡£
ÏÂÃæÎÒÃÇÀ´Ïêϸ˵Ã÷Ò»ÏÂÈçºÎʵÏÖ°É¡£
Ê×ÏÈ£¬ÎÒÃǽ¨Á¢Ò»¸ö½âÎöÆ÷ÅÉÉúÓÚ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  
Ïà¹ØÎĵµ£º
½ñÌ칤×÷ÉÏÅöµ½Ò»¸öÎÊÌâ ÓÉÓÚÎÒÃǵÄÏîÄ¿Êý¾ÝÌ«ÉÙ ËùÒÔÐèÒª´Óweb searchÄDZ߽èµ÷Êý¾Ý£¬ËûÃÇÖ»¸øÎÒÃÇÌṩÁËÒ»¸öxmlµÄ½Ó¿Ú¡£Òò´Ë£¬ÎÒÃÇÐèÒª°ÑxmlµÄÊý¾Ýת»¯³Éhtml³ÊÏÖ¸ø´ó¼Ò¡£ÓÉÓÚÏîÄ¿ÊÇ»ùÓÚphpµÄ£¬ËùÒÔ¾ÍÞðÆúÁËÓÃjsÀ´¶ÁÈ¡xmlÑ¡ÔñÁ˼ÌÐøÊ¹ÓÃphp¡£²»¹ý£¬ÎÒÒÔǰ´ÓÀ´Ã»ÓÐ×ö¹ý´ËÀàµÄ³¢ÊÔ ËùÒÔÕÒÁ˺ܶàÍøÉÏ×ÊÁÏͬʱ²ÎÕÕÁËphpµÄ¹¤× ......
Xml, xslt, xsd, xpathÃèÊöÒ»ÏÂ
XML: Extensible Markup LanguageÀ©Õ¹±ê¼ÇÓïÑÔ£¬ÓÃÀ´´¦Àí½á¹¹»¯Îĵµ¡£
XSLT: XSL Transformations¡£ÓÃÀ´½«Ò»ÖÖXMLת»»³ÉÁíÍâÒ»ÖÖXMLÎĵµ¡£Ò²¿ÉÒÔ½«XMLת»»³ÉXHTML»òÕßHTMLÔÚä¯ÀÀÆ÷ÖÐÏÔʾ¡£
XSD: XML Schemas Definition¡£ÓÃÀ´¶¨ÒåXMLÎĵµµÄ½á¹¹¡£XML Schema ÊÇDTD(Document Type Definiti ......
CollectionÖ÷ÒªÊÇÖ¸ÏñArray, ArrayList, List, Dictionary, HashTableÕâЩÊý¾ÝÀàÐÍ£¬´ó¼ÒƽʱÓõĺܶࡣÈç¹ûÒ»¸öÀàÖÐÓÐÒ»¸öCollectionÀàÐ͵ijÉÔ±£¬ÔÚ¶ÔÕâ¸öÀà½øÐÐXMLÐòÁл¯µÄʱºò£¬Ó¦¸ÃÈçºÎ´¦Àí£¿Ó¦¸Ã˵ÔÚ.netµ±ÖÐÕâÊDZȽϼòµ¥µÄ£¬Ö»Òª½¨Á¢Ò»¸öXmlSerializerÀà¾Í¿ÉÒÔ°ïÄã×Ô¶¯¸ã¶¨£¬²»¹ýÓеÄʱºòÄã¿ÉÄÜÐèÒª¶Ô×Ô¶¯µÄÐòÁл¯¹ý³ ......
//xmlÎĵµÄÚÈÝ
<?xml version = "1.0" encoding="gb2312" standalone="yes"?>
<VFPData>
<company>
<companyno>100</companyno>
<companyname>ÉϺ£</companyname>
<ceoname>³ÂËÄ</ceoname>
<ceoma ......