Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Dodavanje u XML]
- Izgled XML-a:
- <?xml version="1.0" encoding="utf-8"?>
- <dataset>
- <Objekt naziv="Caffe bar Skola" adresa="Matije Gupca 78" grad="Virovitica" lat="45.842" lng="17.388" tip="1" zona="2"/>
- </dataset>
- Primjer:
- XMLDocument xmlDoc;
- xmlDoc.LoadFile("ime_xmla.xml");
- XMLElement *pRoot = xmlDoc.FirstChildElement("dataset");
- XMLElement * pElement = xmlDoc.NewElement("Objekt");
- pElement->SetAttribute("naziv", sNaziv.c_str());
- pElement->SetAttribute("adresa", sAdresa.c_str());
- pElement->SetAttribute("grad", sGrad.c_str());
- pElement->SetAttribute("lat", fLat);
- pElement->SetAttribute("lng", fLng);
- pElement->SetAttribute("tip", nTip);
- pElement->SetAttribute("zona", nZona);
- pRoot->InsertEndChild(pElement);
- xmlDoc.SaveFile("ime_xmla.xml");
- Pokraj svake string varijable kod upisa treba dodati .c_str() inace ce gresku bacati
Advertisement
Add Comment
Please, Sign In to add comment