Reading a XML with ofXML // bad performance?

Hi community, as newbie with OF I’m facing lot of problems.
Now I’m reading a XML with 1k child,

As this example:

<pos id='0'> <x>86</x> <y>864</y></pos>
<pos id='1'> <x>86</x> <y>865</y></pos>
<pos id='2'> <x>86</x> <y>866</y></pos>
<pos id='3'> <x>87</x> <y>864</y></pos>
<pos id='4'> <x>87</x> <y>865</y></pos>
<pos id='5'> <x>87</x> <y>866</y></pos>

The entire operation of reading the XML and a pushing to a vector is taking 4 minutes. Possibly I’m doing something wrong, I used to read this with Processing and was instantly operation.

Does anyone have any idea how I can improve the performance of this code?
Thanks in advance.

This is how I read and push to a vector.

void Canvas7::createDots(){
    ofFile file;"of_data/positions_100_1024_1.xml");
    ofBuffer buffer = file.readToBuffer();
    ofXml positions;
    for (int i = 0; i < positions.getNumChildren(); i++) {
        string _x = positions.getValue("pos["+ofToString(i)+"]/x");
        string _y = positions.getValue("pos["+ofToString(i)+"]/y");
        movers.push_back(Mover(ofRandom(0.5,2), ofToFloat(_x), ofToFloat(_y)));

the problem is you are having it do individual searches for pos1, pos2, pos3, etc. So on each instance, it searches the entire tree to find each one. check out the xmlExample in the examples folder that shows how to properly traverse xml. i am not 100% sure this completely works, but it should be something like this:

the xml file should look like:


and the code to get the data from it:

do {
    int x = xml.getValue<int>("x");
    int y = xml.getValue<int>("y");
} while (positions.setToSibling());

Thanks, worked incredibly fast!