Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. int main(int argc, char *argv[])
  2. {
  3. xml_document doc;
  4. xml_parse_result result = doc.load_file("s10_basic1.xml");
  5. if (result.status != status_ok)
  6. {
  7. doc.print(cout);
  8.  
  9. cout << result.description() << endl;
  10. cout << "bład wczytania xml, wcisnij enter " << endl;
  11. cin.ignore(1);
  12. exit(-1);
  13. }
  14.  
  15. float x[10], y[10];
  16. x[0] = atof(doc.child("root").child("frames").child("frame").child_value("x"));
  17. y[0] = atof(doc.child("root").child("frames").child("frame").child_value("y"));
  18.  
  19. cout << x[0] << "," << y[0] << endl;
  20.  
  21. xml_node frames = doc.child("root").child("frames");
  22.  
  23.  
  24. x[1] = atof(doc.child("frame").next_sibling().child_value("x"));
  25. y[1] = atof(doc.child("frame").next_sibling().child_value("y"));
  26.  
  27. cout << x[1] << "," << y[1] << endl;
  28.  
  29.  
  30. xml_node frame = frames.first_child();
  31.  
  32. int i = 0;
  33.  
  34.  
  35.  
  36. vector<float> v_x;
  37. for (frame = frames.first_child(), i = 0; frame; frame = frame.next_sibling())
  38. v_x.push_back(atof(frame.child_value("x")));
  39.  
  40.  
  41.  
  42. vector<float> v_y;
  43. for (frame = frames.first_child(), i = 0; frame; frame = frame.next_sibling())
  44. v_y.push_back(atof(frame.child_value("y")));
  45.  
  46.  
  47. // wypisac
  48.  
  49.  
  50. samochod s1;
  51.  
  52. for (frame = frames_child(); frame; frame = frame.next_sibling())
  53. {
  54. struct Frame f;
  55. f.pos.x = atof(frame.child_value("x"));
  56. f.pos.y = atof(frame.child_value("y"));
  57. s1.frame.push_back(f);
  58.  
  59. }
  60. cout << "wwektorowo";
  61. cout << s1.frame[0].pos.x << "," << s1.frame[0].pos.y << endl;
  62.  
  63.  
  64.  
  65.  
  66.  
  67. cin.ignore(1);
  68. exit(-1);
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement