C++11 Trouble accessing node by name with rapidxml::first_node

42 Views Asked by At

I am confused as to why I can find the node by name through next_sibling. But when I try to use first_node I am getting a segfault.

The parent node containing all the nodes I need to find.

rapidxml::xml_node<> *xmlnode_chd = xml_doc->first_node(); 

The two lines to access the node

xmlnode_chd->first_node()->next_sibling("name_to_find")->name(); //Works
xmlnode_chd->first_node("name_to_find")->name();                 //Fails

To my understanding a sibling node has the same parent. I thought that the logic between these two statements was the same. I am probably overlooking something simple.

0

There are 0 best solutions below