pugixml库的一个使用心得

作者:朱金灿

来源:http://blog.csdn.net/clever101

 

     使用pugixml库解析xml文件时发现一个规则。如果是解析英文的unicode字符的xml文件(包括utf8和utf16),可以直接使用xml_document类的load_file接口直接打开xml文件。但是要解析包含中文、日文等文字的unicode字符的xml文件,就必须使用xml_document类的load接口。具体用法如下:


std::locale::global(std::locale("chs"));
const std::wstring strFilePath = _T(“c:\\ xgconsole.xml”);
std::wifstream stream(strFilePath.c_str());
pugi::xml_document doc;
doc.load(stream);


原文地址:https://www.cnblogs.com/lanzhi/p/6470805.html