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

How to parse XML file using CParser class


Reviewer Approved    
The following example shows how to parse XML file using Symbian OS C++ class, CParser. CParser is basically a SAX (Simple API for XML)-based XML parser.
It uses an active object to read the XML file chunk by chunk (see CXmlHandler::StartParsingWithAoL() method). On each chunk, it passes the buffer to the XML parser. When the XML parser finds an element, it calls the respective callback functions, for example CXmlHandler::OnStartElementL() or CXmlHandler::OnEndElementL().
To use CParser class, the XmlFramework.lib has to be included in the .mmp file. For more information about CParser, please visit some links at the end of this page.
Contents
[hide]
 1 XmlHandler.h
 2 XmlHandler.cpp
 3 download example
 4 See Also
[edit] XmlHandler.h
#ifndef __XMLHANDLER_H__
#define __XMLHANDLER_H__
 
// INCLUDE FILES
#include <e32base.h>
#include <f32file.h>  //Link against efsrv.lib
#include <xml\contenthandler.h> // for MContentHandler
#include <xml\parser.h> // for CParser
 
// CLASS DECLARATION
 
using namespace Xml;
 
class CXmlHandler: public CActive, MContentHandler
    {
 
public: // Constructors and destructor
 
    static CXmlHandler* NewL();
 
    static CXmlHandler* NewLC();
 
    virtual ~CXmlHandler();
 
public: // Public methods
 
    void StartParsingWithAoL( const TDesC& aFileName );
 
private: // Constructors
 
    CXmlHandler();
 
    void ConstructL();
 
private: // from CActive
 
    void DoCancel();
 
    void RunL();
 
private: // from MContentHandler
 
    void OnStartDocumentL( const RDocumentParameters &aDocParam,
  &n


Ïà¹ØÎĵµ£º

asp.net Êä³öXMLÎļþ

private void WriteXML()
{
StringBuilder sb = new StringBuilder();
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> ");
sb.Append(" <!-- ");
sb.Append("<content>");
sb.Append(& ......

ÓÃphp¶ÁÈ¡xmlÊý¾Ý


½ñÌ칤×÷ÉÏÅöµ½Ò»¸öÎÊÌâ ÓÉÓÚÎÒÃǵÄÏîÄ¿Êý¾ÝÌ«ÉÙ ËùÒÔÐèÒª´Óweb searchÄDZ߽èµ÷Êý¾Ý£¬ËûÃÇÖ»¸øÎÒÃÇÌṩÁËÒ»¸öxmlµÄ½Ó¿Ú¡£Òò´Ë£¬ÎÒÃÇÐèÒª°ÑxmlµÄÊý¾Ýת»¯³Éhtml³ÊÏÖ¸ø´ó¼Ò¡£ÓÉÓÚÏîÄ¿ÊÇ»ùÓÚphpµÄ£¬ËùÒÔ¾ÍÞðÆúÁËÓÃjsÀ´¶ÁÈ¡xmlÑ¡ÔñÁ˼ÌÐøÊ¹ÓÃphp¡£²»¹ý£¬ÎÒÒÔǰ´ÓÀ´Ã»ÓÐ×ö¹ý´ËÀàµÄ³¢ÊÔ ËùÒÔÕÒÁ˺ܶàÍøÉÏ×ÊÁÏͬʱ²ÎÕÕÁËphpµÄ¹¤× ......

javaÖÐËÄÖÖ²Ù×÷xml·½Ê½µÄ±È½Ï

   1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
    DOMÊÇÓÃÓëÆ½Ì¨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐѰÕÒÌØ¶¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµºÍ¹¹Ôì²ã´Î½á¹¹£¬È»ºó²ÅÄÜ×öÈκι¤×÷¡£ÓÉÓÚËüÊÇ»ùÓÚÐÅÏ¢²ã´ÎµÄ£¬Òò¶øDO ......

Ìí¼ÓÍ·ÎļþÖеÄxml,script,cssµÈÄÚÈÝ·½·¨

function   $import(path,type,title,idname){  
          var   s,i;  
          if(type=="js"){  
         &nb ......

ΪʲôʹÓà XML£¿


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