Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char *argv[])
- {
- xml_document doc;
- xml_parse_result result = doc.load_file("s10_basic1.xml");
- if (result.status != status_ok)
- {
- doc.print(cout);
- cout << result.description() << endl;
- cout << "bład wczytania xml, wcisnij enter " << endl;
- cin.ignore(1);
- exit(-1);
- }
- float x[10], y[10];
- x[0] = atof(doc.child("root").child("frames").child("frame").child_value("x"));
- y[0] = atof(doc.child("root").child("frames").child("frame").child_value("y"));
- cout << x[0] << "," << y[0] << endl;
- xml_node frames = doc.child("root").child("frames");
- x[1] = atof(doc.child("frame").next_sibling().child_value("x"));
- y[1] = atof(doc.child("frame").next_sibling().child_value("y"));
- cout << x[1] << "," << y[1] << endl;
- xml_node frame = frames.first_child();
- int i = 0;
- vector<float> v_x;
- for (frame = frames.first_child(), i = 0; frame; frame = frame.next_sibling())
- v_x.push_back(atof(frame.child_value("x")));
- vector<float> v_y;
- for (frame = frames.first_child(), i = 0; frame; frame = frame.next_sibling())
- v_y.push_back(atof(frame.child_value("y")));
- // wypisac
- samochod s1;
- for (frame = frames_child(); frame; frame = frame.next_sibling())
- {
- struct Frame f;
- f.pos.x = atof(frame.child_value("x"));
- f.pos.y = atof(frame.child_value("y"));
- s1.frame.push_back(f);
- }
- cout << "wwektorowo";
- cout << s1.frame[0].pos.x << "," << s1.frame[0].pos.y << endl;
- cin.ignore(1);
- exit(-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement