0

嗯,我有代码

pugi::xml_node text = doc.child("text").child("girl");

for (int i = 0; i < situations.size(); i++)
{
    std::cout << situations[i] << std::endl;
    text = text.child(situations[i].c_str()); // problem
}

在该代码之后,我无法从文本中获取任何值,但可以直接使用 like

doc.child("text").child("girl").child_value("day1")

正在工作中。需要帮忙。谢谢。

4

1 回答 1

0

您应该使用 text.child_value() 或 text.text().get() 而不是 text.value()。

child_value("a") 等价于 child("a").child_value(),而不是 child("a").value()。原因是文本位于特殊的 PCDATA 节点中 - child_value() 通常与 first_child().value() 相同。

于 2013-07-19T19:18:56.253 回答