0

Well, I got code

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
}

After that code, I can't get any values from text, but straight using like

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

Is working. Need help. Thanks.

Karlo
  • 1,630
  • 4
  • 33
  • 57
  • What is that situations? What it contains? did you try using doc.child(situations[i].c_str())? –  Jul 19 '13 at 06:19

1 Answers1

0

Instead of text.value(), you should use either text.child_value() or text.text().get().

child_value("a") is equivalent to child("a").child_value(), not child("a").value(). The reason is that text is located in special PCDATA nodes - child_value() usually is the same as first_child().value().

zeuxcg
  • 9,216
  • 1
  • 26
  • 33