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
相关文档:
在平时工作中,难免会遇到把 XML 作为数据存储格式。面对目前种类繁多的解决方案,哪个最适合我们呢?在这篇文章中,我对这四种主流方案做一个不完全评测,仅仅针对遍历 XML 这块来测试,因为遍历 XML 是工作中使用最多的(至少我认为)。
预 备
测试环境:
AMD 毒龙1.4G OC 1.5G、256M DDR333、Wind ......
标签:XML解析 TinyXML [推送到技术圈]
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://panpan.blog.51cto.com/489034/104961
最近使用TinyXML进行C++ XML解析,感觉使用起来比较简单,很容易上手,本文给出一个使用TinyXML进行XML解 ......
数据库应用系统包括数据库,数据库管理系统,数据库应用三大部分。
世界上存在许多完全不同的客户平台,在不同平台间交换数据,需要保证数据的完整和服务的高效,数据格式的转换问题往往成为制约Web Service的瓶颈,采用XML作为数据交换的标准,可以使各个异构平台和各种格式的数据进行数据交换成为可能。
......
function $import(path,type,title,idname){
var s,i;
if(type=="js"){
&nb ......
任何ORM的解决方案都应该提供一种易读的、容易编辑的映射文件格式,而不仅仅提供一个GUI图形工具。当下流行的对象/关系元数据格式都支持XML。使用XML格式的文件可以提供如下好处:首先它是轻量级的,提供很好的易读性,能够进行版本控制,可以在部署阶段定制。
但是XML格式文件真的是最好的选择吗?Java社团中就反对XML ......