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

Example Code of Using XML Parser in Symbian OS

antonypr | 14 April, 2007 00:05
A couple of weeks ago, I had a plan to write an article and example code of using XML parser in Symbian OS. It seems that another Forum Nokia Champion, Paul Todd had the same idea. He posted a nice article about XML parser in Symbian OS 9.x to Forum Nokia Blogs. It's good that I don't need to write the same article. :)
What I would like to share here is a complete example code of XML Parser in Symbian OS. The example code can be run on Symbian OS 8 and 9 phones, which means it can be compiled under S60 2nd Edition FP2/FP3 SDK or S60 3rd Edition SDK. I am planning to release the same example code for UIQ3 soon.
Click here to download my example code of XML parser
The example  basically parses an XML file, dataexample.xml, to the main window. The content will be displayed on CEikEdwin control (see picture below).
Note that the code is written as an example; thus it is designed to be as simple as possible. Do not use it in the production code!
One more thing, this is not the official example code from Forum Nokia. It is just my personal example code.
 S60, Symbian C++ |  Next |  Previous |  Comments (11) |  Trackbacks (0)
 Comments
Re: Example Code of Using XML Parser in Symbian OS
sandordornbush | 17/05/2007, 20:52
This is great starting point. However I need to parse a fairly large file (~8kB). Can you give any advice how to adapt this code to one where the whole file does not need to be loaded in one shot? I also posted this on the forums at:
http://discussion.forum.nokia.com/forum/showthread.php?t=108183
Re: Example Code of Using XML Parser in Symbian OS
jp4symbian | 13/06/2007, 15:26
This is an extremely useful example for parsing Xml specially since there is no such example on Forum.Nokia.
I have studied your example and have been able to successfully parse my Xml. But I also need to parse the tag attributes which is not implemented in your example.
I assume that attributes o


Ïà¹ØÎĵµ£º

JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOMƪ

ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
 <book>
  <name>¹þÀï²¨Ì ......

XMLµÄһЩ¼òµ¥ÎÊÌ⣡

£¨µÚ1Õ£©
(P1~3)1£®ÓÃ×Ô¼ºµÄÓïÑÔ¶ÔSGML¡¢HTMLºÍXML×÷¼òµ¥½éÉܺͶԱȡ£
SGML  ÊÇÒ»ÖÖ²ÉÓñê¼ÇÀ´ÃèÊöÎĵµÊý¾ÝµÄͨÓÃÓïÑÔ£¬SGML¶¨ÒåÁË»ù±¾µÄÓï·¨ºÃ£¬Í¬Ê±Ò²ÔÊÐíÓû§½¨Á¢×Ô¼ºµÄÔªËرê¼Ç¡£
HTML ²ÉÓÃÁ˺ÜСһ²¿·ÖSGMLµÄ±ê¼Ç£¬Í¬Ê±HTML²ÉÓõÄÊǹ̶¨±ê¼ÇÒ²²»ÐèÒª°üº¬DTD¡£
XML ͬHTMLÒ»Ñù£¬¶¼Êdzö×ÔÓÚSGML±ê׼ͨÓñê¼ÇÓï ......

ÓÃCMarkUpÀà½âÎöXMLÎļþ

½âÎö£º
 CMarkup xml;
 CString strChanText, strChanType;
 xml.Load("MyXml.xml");
 xml.ResetMainPos();
 if (!Chan.FindElem("TreeOrg"))
 {
      return;
 }
 if (xml.IntoElem())
 {
      xml.FindEle ......

ΪʲôʹÓà XML£¿


Web ʹÎÒÃÇÄܹ»ÓëÈκεط½µÄÈκÎÈËͨѶ¡£¹ã·º½ÓÊܵıê×¼£¨Õâ¶ÔÍêȫʹÓà Web µÄDZÁ¦ÊÇÖÁ¹ØÖØÒªµÄ£©ÔÊÐí Web ÔÚ¶àÖÖ½»»¥²Ù×÷µÄ¼¼Êõ²ãÉÏͨѶ¡£Ò»¸öÖØÒª²ãÊÇ¿ÉÊÓ»¯ÏÔʾºÍÓû§½çÃ棬ÀýÈç HTML¡¢GIF ºÍ JScript(TM) Ö®ÀàµÄÏÖÓбê×¼¡£ÕâЩ±ê×¼ÔÊÐí´´½¨Ò»´ÎÒ³Ã棬²¢ÇÒÔÚ²»Í¬Ê±¼äÏòÖÚ¶à½ÓÊÕÕßÏÔʾ¡£
¾¡¹Ü¿ÉÊÓ»¯ºÍÓû§½çÃæ±ê×¼ÊÇ±Ø ......

Symbian OSϽâÎöXMLÎĵµµÄһЩ·½·¨

2009-10-27 22:44×ÊÁÏÀ´Ô´ÓÚÍøÂç,ËÄÖÖ·½Ê½,´ó¼Ò¿ÉÒÔ×Ô¼º³¢ÊÔÏÂ.
=========11111=================
tinyXML
www.grinninglizard.com/tinyxml/
=========22222================================
symbian s60 µÚÈý°æÖ®ºó£¬ÒѾ­ÌṩÁ˽âÎöxmlµÄϵͳapi,²ÉÓõÄÊÇSAX·½Ê½¡£
XML parsing in Symbian OS v9.x À´Ô´Ä¿Â¼£º
htt ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ