boost ptree的XML版本和编码
XML version and encoding from boost ptree
我正在使用boost ptree来解析xml
read_xml(stream, pt, trim_whitespace | no_comments);
<?xml version="1.0" encoding="windows-1252"?>
<rss>
<channel>.....</channel>
</rss>
如何读取xml的版本和编码:我尝试了以下
std::string encoding = pt.get<std::string>("<xmlattr>.encoding", "");
其给出空字符串。如何获取xml的版本和编码?
处理指令不是XML元素(事实上,它是……一条处理指令)。
处理指令不具有<xmlattr>
意义上的属性。您会注意到没有与之对应的ptree节点。
这里有一种未记录的方法来实现您可能想要的功能:添加xml样式表处理指令以增强property_tree
相关文章:
- 如何确定我已使用非编码文件到达 EOF?
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 导入库可以跨dll版本工作吗
- 在调用FreeLibrary后,释放动态链接到具有相同版本的CRT堆的DLL的内存
- 使用 MATLAB 编码器生成C++代码:编译错误"undefined reference to `rgb2gray_tbb_real64'"
- 在clang++预处理器中确定gcc工具链版本
- 码头化的C++应用程序是否向后兼容早期的内核版本
- 在卡萨布兰卡形成编码参数的列表
- 不同的Visual Studio版本中缺少.dll
- 用符号版本替换对函数的所有调用
- luaL_dofile在已知良好的字节码上失败,可以使用未编译的版本
- 正在解码MSVC 32位版本的程序集(作业).没有手术做什么
- 我需要分发哪些版本的可再分发文件
- 使用C++进行游程编码
- 如何将不同的可执行文件合并到一个窗口框架中进行编码?像浏览器一样
- CV_OCL_RUN宏如何在OpenCV(版本3.4.5)的goodFeaturesToTrack实现中工作?
- 使用已使用 java 编码的 openssl 解码数据
- boost ptree的XML版本和编码
- 如何在性能和VMS上对C++进行代码审查/调试/编码/测试/版本控制
- 使用哪种版本的.NET Framework进行编码最安全