Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

RSS Reader Plug-in for Internet Explorer

, 17 Jul 2007 CPOL
This is a toolbar for the Internet Explorer which shows information from RSS taken from the Internet.
rssreader_exe.zip
Setup.exe
rssreader_src.zip
RssReader_src
RRPRssFetcher
RRPRssFetcher
res
RRPRssFetcher.ico
toolbar.bmp
RRPRssFetcher.vcproj.TEKAWADE.Prafulla V Tekawade.user
RSSReaderplugin
Debug
res
RssReaderPlugin.dll.manifest
RRPComInterfaceImplementor.rgs
RssReaderPlugin.aps
RssReaderPlugin.def
RssReaderPlugin.dsp
RssReaderPlugin.dsw
RssReaderPlugin.opt
RssReaderPlugin.plg
RssReaderPlugin.tlb
RssReaderPlugin.vcproj.TEKAWADE.Prafulla V Tekawade.user
RssReaderPluginps.def
RssReaderPluginps.mk
Setup.iss
/*
	Project		: RSS Reader plugin for Internet Explorer
	File Name	: RRPRssParser.cpp
	Date		: 
	Purpose		: It is the parser for the rss file. 
	Note		: 
	Send comments 
	or Bugs to	: prafulla_t@users.sourceforge.net
*/
#include "StdAfx.h"
#include "RRPRssParser.h"

#include <iostream>
#include <string>

RRPRssParser::RRPRssParser(const char *nameOfFile) {
	doc = new TiXmlDocument(nameOfFile);
	errorCode = doc->LoadFile();
	//Store it in private variable,for future reference
	fileName = new char[strlen(nameOfFile) + 1];
	strcpy(fileName,nameOfFile);
}

RRPRssParser::~RRPRssParser(void) {
	if(fileName)
		delete fileName;
	if(doc)
		delete doc;
	int n = rssItemVector.size();
	for(int i = 0; i< n;i++)
		delete rssItemVector[i];
}

//Parses the RSS file,and fills up all the required structurs  
//It SHOULD be called before getting the reference of RRPRssItemIterator
void RRPRssParser::parse() {
	TiXmlElement *rootElement = doc->FirstChildElement();
	TiXmlElement *itemElement;
	TiXmlElement *titleElement,*linkElement,*descElement;
	RRPRssItem *rssItem = NULL;

	if(rootElement) {
		rootElement = doc->FirstChildElement();
		if(!rootElement)
			return;
		rootElement = rootElement->FirstChildElement();
		if(!rootElement)
			return;
		//Now getting Item 
		itemElement = rootElement->FirstChildElement("item"); 
		while(itemElement) {
			titleElement = itemElement->FirstChildElement("title");
			linkElement = itemElement->FirstChildElement("link");
			if(!linkElement)
				linkElement = itemElement->FirstChildElement("guid");
			descElement = itemElement->FirstChildElement("description");
/*			pubElement =  itemElement->FirstChildElement("pubDate");
			if(!pubElement)
				return;*/
			rssItem = new RRPRssItem();

			if(titleElement && (titleElement->GetText())) 
					rssItem->setTitle(titleElement->GetText())			;
			else 
				rssItem->setTitle("No Title,Have a look at Description!!");

			if(linkElement && (linkElement->GetText())) 
				rssItem->setLink(linkElement->GetText());
			else
				rssItem->setLink("No Link");
			
			if(descElement && (descElement->GetText()))
				rssItem->setDescription(descElement->GetText());
			else
				rssItem->setDescription("No Description");
			
/*			if(pubElement)
				std::cout << pubElement->ValueTStr().c_str() << " :: " <<  pubElement->GetText() << std::endl;
			else
				std::cout << "No PubDate" << std::endl;*/
			rssItemVector.push_back(rssItem);
			itemElement = itemElement->NextSiblingElement();
		}

		}

}

//Returns true if there is no error
BOOL RRPRssParser::isError() {
	return !errorCode;
}

//Returns Error String if there is Error and "No Error" string otherwise
const char* RRPRssParser::getErrorString() {
	if(errorCode)
		return "No Error";
	return doc->ErrorDesc();
}

BOOL RRPRssParser::hasNext() {
	return (index+1) < (rssItemVector.size());
	
}

//Returns Current RssItem
RRPRssItem* RRPRssParser::getItem() {
	return rssItemVector[++index];
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

PrafullaT

India India
Quote : "Life is all about solving problems and enjoying their solutions !! "

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150302.1 | Last Updated 17 Jul 2007
Article Copyright 2007 by PrafullaT
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid