You Are Here:

Community: Wiki

This page was last modified on 31 March 2009, at 19:30.

How to import landmarks from file to database

From Forum Nokia Wiki

You can use class CPosLandmarkParser for parsing the landmark content, this functionality can be used for importing data from files. The type (e.g. the mime type) must be specified for creating instance of this class. You can use mime type "application/vnd.nokia.landmarkcollection+xml".

The following code snippet demonstrates how to import data from the XML-file to the specified local landmark database. It is necessary to include the following headers:

#include <epos_cposlmdatabasemanager.h>
#include <epos_hposlmdatabaseinfo.h>
#include <epos_cposlandmarkparser.h>

And link against:

LIBRARY  eposlandmarks.lib
LIBRARY eposlmdbmanlib.lib
// db URI
_LIT( KNewDbUri, "file://C:new.ldb" );
TBuf<32> newDbUri( KNewDbUri );
 
// file with landmarks
_LIT( KSrcFile, "C:\\LmBackup\\my_lms.xml" );
 
// db manager
CPosLmDatabaseManager* dbManager = CPosLmDatabaseManager :: NewL();
CleanupStack :: PushL( dbManager );
 
// create database, if necessary
if( !dbManager->DatabaseExistsL( newDbUri ) )
{
HPosLmDatabaseInfo* dbInfo = HPosLmDatabaseInfo :: NewLC( newDbUri );
dbManager->CreateDatabaseL( *dbInfo );
CleanupStack :: PopAndDestroy( dbInfo );
}
 
// open DB and init it, if necessary
CPosLandmarkDatabase* db = CPosLandmarkDatabase :: OpenL( newDbUri );
CleanupStack :: PushL( db );
if( db->IsInitializingNeeded() )
ExecuteAndDeleteLD( db->InitializeL() );
 
// clear the database (batch mode)
ExecuteAndDeleteLD( db->RemoveAllLandmarksL() );
 
// MIME type for import & export
_LIT8( KPosMimeTypeLandmarkCollectionXml, "application/vnd.nokia.landmarkcollection+xml" );
 
// Create the parser to be used for importing landmarks
CPosLandmarkParser* parser = CPosLandmarkParser :: NewL( KPosMimeTypeLandmarkCollectionXml );
CleanupStack :: PushL( parser );
 
// import data (batch mode)
parser->SetInputFileL( KSrcFile );
ExecuteAndDeleteLD( db->ImportLandmarksL( *parser, CPosLandmarkDatabase::EDefaultOptions ) );
 
CleanupStack :: PopAndDestroy( 3 ); // parser db dbManager

Related Links:

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fHttpE3aE2fE2fE78ishisniceplaceE2echatE2eruE2fimagesE253FX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ