I'm trying to append a very big subtree using rapidxml in a dirty way, exploiting the value
method
rapidxml::xml_node<>* node = allocate_node(rapidxml::node_element, "tree");
node->value("<very><long><subtree></subtree></long></very>");
but it but the angle brackets are expanded into <
and >
when I print the document. The clean way would be to manually declare and append every single node and attribute of the subtree, which is pretty boring.
Is there a way to prevent brackets expansion, or can you suggest any other practical way to quickly add a big branch?
Ok, I came out with this workaround, automatically creating the structure and appending it:
char txt[] = "<very><long><xml with="attributes"></xml></long></very>"; // or extract from file
rapidxml::xml_document<char> tmp;
tmp.parse<0>(txt);
rapidxml::xml_node<char> *subt = tmp.first_node();
tmp.remove_all_nodes(); // detach, since you can't have more than one parent
appendHere.append_node(subt);
any idea to improve it, maybe to avoid the extra overhead to parse the subtree?