本文整理汇总了C++中pugi::xml_document::load_buffer_inplace方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_document::load_buffer_inplace方法的具体用法?C++ xml_document::load_buffer_inplace怎么用?C++ xml_document::load_buffer_inplace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pugi::xml_document
的用法示例。
在下文中一共展示了xml_document::load_buffer_inplace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getProperty
Weather::Weather(std::string city,std::string state, int day) {
//Constructor ran every time we make a Weather object
xml_data = "";
this->day = day;
//its best to not re-download all of this redundant information every time you change weather
//but the alternative would take longer to make/outside my skill
std::cout << "City: "<< city << std::endl;
std::cout << "State: "<< state << std::endl;
std::replace(city.begin(),city.end(),' ','-');
std::replace(state.begin(),state.end(),' ','-');
std::string url_str = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22"
+ city + "%2C%20" + state + "%22)&format=xml&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
char* ustr = new char[url_str.size()];
strcpy(ustr, url_str.c_str());
getWeatherData(ustr);
char* cstr = new char[xml_data.size() + 1];
strcpy (cstr, xml_data.c_str());
size_t size = xml_data.size() + 1;
pugi::xml_parse_result result = doc.load_buffer_inplace(cstr, size);
cond = getProperty("code");
if(day >= 0){
temp = getProperty("high");
} else {
temp = getProperty("temp");
}
delete[] cstr;
delete[] ustr;
}
示例2: ParseXML
void CWOBackendReq::ParseXML(pugi::xml_document& xmlFile)
{
pugi::xml_parse_result parseResult = xmlFile.load_buffer_inplace((void*)bodyStr_, bodyLen_);
if(!parseResult)
r3dError("Failed to parse server XML, error: %s", parseResult.description());
}