如何使用boost::property\u tree::write\u XML设置目标XML doctype?
我想通过如何使用boost::property\u tree::write\u XML设置目标XML doctype?,boost,doctype,boost-propertytree,Boost,Doctype,Boost Propertytree,我想通过boost::property\u tree::write\u XML设置生成的XML文档的DOCTYPE: #include <string> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> int main() { using ptree = boost::property_tree::ptree; pt
boost::property\u tree::write\u XML
设置生成的XML文档的DOCTYPE:
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
int main()
{
using ptree = boost::property_tree::ptree;
ptree pt;
pt.put("ExampleKey", "ExampleValue");
std::ofstream file("test.xml");
boost::property_tree::write_xml(file, pt);
}
#包括
#包括
#包括
int main()
{
使用ptree=boost::property_tree::ptree;
ptree-pt;
pt.put(“ExampleKey”、“ExampleValue”);
std::of流文件(“test.xml”);
boost::property_tree::write_xml(文件,pt);
}
我尝试了xml\u writer\u设置
,但关于它的有用文档很少。因此,我甚至不知道它是否有帮助,或者它的目的是否完全不同
如何通过
boost::property\u tree::write\u XML>在生成的XML中设置DOCTYPE?
您不能。毫不奇怪,Boost属性树不是XML库。这是一个属性树库
编写XML时,考虑使用XML库:
此外,可能存在使用未记录接口的黑客行为: 这样,您就可以有效地绕过文档编写代码,并用自己的hack替换它