Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "tinyxml.h"
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main() {
- const char * xmlFileName = "test.xml";
- TiXmlDocument _xmlDoc;
- const char *_currentVersion;
- const char *new_v = "012345";
- _xmlDoc.LoadFile(xmlFileName);
- TiXmlNode *root = _xmlDoc.FirstChild("GUPInput");
- if (!root)
- {
- printf("It's not a valid GUP input xml.");
- return -1;
- }
- TiXmlNode *versionNode = root->FirstChildElement("Version");
- if (versionNode)
- {
- TiXmlNode *n = versionNode->FirstChild();
- if (n)
- {
- const char *val = n->Value();
- if (val)
- {
- _currentVersion = val;
- printf("Actual version is %s\n", val);
- n->SetValue(new_v);
- printf("Actual version should be %s\n", new_v);
- }
- }
- }
- _xmlDoc.SaveFile();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement