Esempio n. 1
0
void currencyHandler::startElement(const XMLString& uri,
		const XMLString& localName, const XMLString& qname,
		const Attributes& attributes) {
	//		where("startElement");
	std::cout << "start element uri:       " << uri << std::endl
			<< "localName: " << localName << std::endl << "qname:     "
			<< qname << std::endl;

	if (localName.compare("resource") == 0) {
		std::cout << " Quote starting here.." << std::endl;

		inQuote = true;
	} else if (localName.compare("field") == 0) {
		std::cout << " field starting here.." << std::endl;
		//	std::cout<<" field value is "<<attributes.getValue(i)<<std::endl;
	}

	std::cout << "Attributes: " << std::endl;
	for (int i = 0; i < attributes.getLength(); ++i) {

		std::cout << " attributes.getValue(i) : " << attributes.getValue(i)
				<< std::endl;

		if (attributes.getValue(i).compare("symbol") == 0) {
			currentFieldReading = symbolType;

		} else if (attributes.getValue(i).compare("ts") == 0) {
			currentFieldReading = tsType;

		} else if (attributes.getValue(i).compare("utctime") == 0) {
			currentFieldReading = utctimelType;

		} else if (attributes.getValue(i).compare("volume") == 0) {
			currentFieldReading = volumeType;

		} else if (attributes.getValue(i).compare("price") == 0) {
			currentFieldReading = priceType;

		} else if (attributes.getValue(i).compare("name") == 0) {
			currentFieldReading = nameType;

		} else if (attributes.getValue(i).compare("type") == 0) {
			currentFieldReading = typeType;

		}

	}
}
Esempio n. 2
0
void currencyHandler::endElement(const XMLString& uri,
		const XMLString& localName, const XMLString& qname) {
	//where("endElement");
	//std::cout<<"localName is "<<localName<<"  allCurrencies size is "<<allCurrencies.size()<<std::endl;

	if (localName.compare("resource") == 0) {
		std::cout << " Quote ending  here.." << std::endl;
		inQuote = false;

		currency c = *currentReadingCurrency;
		allCurrencies.push_back(c);
		/*****************/
		//we can totally ignore comment these lines
		//	delete currentReadingCurrency;
		//		currentReadingCurrency = new currency();
		/***********************/
		std::cout << " currentReadingCurrency.toString() is "
				<< currentReadingCurrency->toString() << std::endl;
		std::cout << " c.toString() is " << c.toString() << std::endl;

	}

}