本文整理汇总了C++中XMLString::compare方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLString::compare方法的具体用法?C++ XMLString::compare怎么用?C++ XMLString::compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLString
的用法示例。
在下文中一共展示了XMLString::compare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
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;
}
}
}
示例2: endElement
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;
}
}