I'm writing a part of my app that store settings in XML file, but I don't want to 'client' duplicate, I want this:
<jack>
<client name="something">
<port name="someport" />
<port name="someport_2" />
</client>
</jack>
But instead I get:
<jack>
<client name="something">
<port name="someport" />
</client>
<client name="something">
<port name="someport_2" />
</client>
</jack>
thought "just check if node already exists" but that's the problem, so I've this piece of code:
// xjack is the root node
pugi::xml_node xclient = xjack.child(sclient.c_str());
if (!xclient) {
xclient = xjack.append_child("client");
}
but !xclient
always evaluate to true, tried also if (xclient.empty())
but not work also.