Skip to content

save_options quesion in save_options.cpp #645

Answered by zeux
Mr-zhangyh asked this question in Q&A
Discussion options

You must be logged in to vote

You would need to use pugi::format_raw and insert the declaration (if necessary) as well as the required newlines yourself, for example:

    pugi::xml_node decl = doc.prepend_child(pugi::node_declaration);
    decl.append_attribute("version").set_value("1.0");
    decl.append_attribute("encoding").set_value("utf-8");
    decl.append_attribute("standalone").set_value("yes");

    doc.insert_child_after(pugi::node_pcdata, decl).set_value("\n");
    doc.append_child(pugi::node_pcdata).set_value("\n");

    doc.save(std::cout, "", pugi::format_raw);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Mr-zhangyh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants