C++ 来自boostptree的XML版本和编码
我正在使用boostptree解析xmlC++ 来自boostptree的XML版本和编码,c++,boost,boost-propertytree,C++,Boost,Boost Propertytree,我正在使用boostptree解析xml read_xml(stream, pt, trim_whitespace | no_comments); <?xml version="1.0" encoding="windows-1252"?> <rss> <channel>.....</channel> </rss> read_xml(流、pt、trim_空格|无注释); ..... 如何读取xml的版本和编码: 我尝试了
read_xml(stream, pt, trim_whitespace | no_comments);
<?xml version="1.0" encoding="windows-1252"?>
<rss>
<channel>.....</channel>
</rss>
read_xml(流、pt、trim_空格|无注释);
.....
如何读取xml的版本和编码:
我尝试了以下方法
std::string encoding = pt.get<std::string>("<xmlattr>.encoding", "");
std::string encoding=pt.get(“.encoding”,”);
它给出了空字符串。
如何获取xml的版本和编码?处理指令不是xml元素(实际上,它是……一条处理指令) 处理指令没有
意义上的属性。您将注意到没有与之对应的ptree节点
这里有一种没有文档记录的方法来实现您可能想要的功能:谢谢@sehe,但我认为xml\u writer\u设置总是返回utf-8作为编码,不是吗?基本上,您发现Boost没有xml库。