If some of the nodes are optional it's likely the library will return NULL
when it cannot find one of them. You probably need to check the returned values are not NULL
before you even dereference the pointers to get any possible value()
:
string sciName = sciName_node->value(); // crash if scientific_name not present
string comName = comName_node->value();
string rank = rank_node->value();
I also think your use of names in the calls for nodes/siblings are a bit brittle. It might be better to just call first_node/next_sibling without a name and then check the name after a node is actually returned (checking for NULL). Then perform name-dependent logic.
This makes you less dependent on the order of data in the XML, which might change down the line.