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
相关文档:
数据库应用系统包括数据库,数据库管理系统,数据库应用三大部分。
世界上存在许多完全不同的客户平台,在不同平台间交换数据,需要保证数据的完整和服务的高效,数据格式的转换问题往往成为制约Web Service的瓶颈,采用XML作为数据交换的标准,可以使各个异构平台和各种格式的数据进行数据交换成为可能。
......
function $import(path,type,title,idname){
var s,i;
if(type=="js"){
&nb ......
解析:
CMarkup xml;
CString strChanText, strChanType;
xml.Load("MyXml.xml");
xml.ResetMainPos();
if (!Chan.FindElem("TreeOrg"))
{
return;
}
if (xml.IntoElem())
{
xml.FindEle ......
第一步:将XML编辑器设置默认为Myeclipse edit
window__Preferences__General____Editors_____File Associations
找到*.xml,选择Myeclipse Xml editor,点default
第二步:配置dtd或者xsd文件
Window → Preferences... → MyEclipse → Files & Editors → ......
Web 使我们能够与任何地方的任何人通讯。广泛接受的标准(这对完全使用 Web 的潜力是至关重要的)允许 Web 在多种交互操作的技术层上通讯。一个重要层是可视化显示和用户界面,例如 HTML、GIF 和 JScript(TM) 之类的现有标准。这些标准允许创建一次页面,并且在不同时间向众多接收者显示。
尽管可视化和用户界面标准是必 ......