Using quickxml, I want to iterate over a set of nodes and use what seems to me to be the best way to do this (from a reliable stackoverflow, the document does not seem to have an iteration example):
while (curNode->next_sibling() !=NULL ) { string shiftLength = curNode->first_attribute("shiftLength")->value(); cout << "Shift Length " << "\t" << shiftLength << endl; curNode = curNode->next_sibling(); }
Unfortunately, on my OSX 10.6, this is leaving the last sibling node - I think because next_sibling is called twice in the last iteration of the loop. I can get this last node if I write after the loop:
cout << " LAST IS: " << curNode->first_attribute("shiftLength")->value();
... but it's quirky, and the program terminates at this point.
First question: can this be a unique error of my installation (OSX 10.6) or am I encoded incorrectly?
Second question: Does anyone have an example of what they think is the right way to iterate through an unknown number of XML nodes using quickxml?
Thanks guys,
Pete
Pete 2233
source share