Using the XML parser for Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Platform(s): S60 2nd Edition FP2, FP3
S60 3rd Edition
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
Created: User:Technical writer 2 (25 Aug 2005)
Last edited: lpvalente (07 May 2014)


Using the XML parser in S60


XML parser framework is available for the S60 platform starting from 2nd Edition, Feature Pack 2.
CParser is a SAX-like parser, which parses XML files or XML strings, element by element. To use it, a content handler class derived from MContentHandler must be implemented. The content handler class implements interface methods such as OnStartElementL() and OnEndElementL(), which are then called by the parser (CParser) for each XML tag. The content handler implementation and MIME type of the parsed document are passed to the CParser object at construction.
  // Link against xmlframework.lib
  #include <xml/parser.h>
  #include <xml/contenthandler>
  #include <xml\XmlFrameworkConstants.h

  // Implements MContentHandler interface
  CMyContentHandler sax;

  // Mime type of the parsed document
  _LIT8(KXmlMimeType, "text/xml");

  // Contruct the parser object
  CParser* parser = CParser::NewLC(KXmlMimeType, sax);

  // Start parsing XML from a descriptor
  // CMyContentHandler will receive events
  // generated by the parser

  // Destroy the parser when done.

This page was last modified on 7 May 2014, at 15:56.
33 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.