1 #include "gearxml/tinyxml.h"
2 #include "gearxml/MergeXML.h"
18 int main(
int argc,
char *argv[] ) {
24 std::cout << std::endl
25 <<
" Program to merge two xml files. This can be used if a gear xml" << std::endl
26 <<
" (that has been automatically created with MokkaGear) is lacking" << std::endl
27 <<
" some information. XML Elements that are present in only one of the input" << std::endl
28 <<
" files will be merged into the target file. In case the same element" << std::endl
29 <<
" exists in either input file the attribute values from the primary file" << std::endl
30 <<
" are taken." << std::endl
32 <<
"usage: " << std::endl
33 <<
" mergeXML <secondary> <primary> <target> " << std::endl
34 <<
" <secondary> filename for base-file that will be overwritten" << std::endl
35 <<
" <primary> filename for file that overrules secondary file" << std::endl
36 <<
" <target> filename for output file " << std::endl
42 std::string fileName1 = argv[1] ;
43 std::string fileName2 = argv[2] ;
44 std::string fileNameNew = argv[3] ;
48 if ( mergeXML.
setFile1 (fileName1) ) {
49 std::cout <<
"secondary : ok" << std::endl ;
52 std::cout <<
"secondary : error reading file " << fileName1 << std::endl ;
56 if ( mergeXML.
setFile2 (fileName2) ) {
57 std::cout <<
"primary: ok" << std::endl ;
60 std::cout <<
"primary: error reading file " << fileName2 << std::endl ;
65 std::cout <<
"target : ok" << std::endl ;
68 std::cout <<
"target: error merging files in " << fileNameNew << std::endl ;
76 std::cout <<
" An Exception occured : " << e.what() << std::endl ;
bool mergeFiles(const std::string &fileName)
merges files
Base exception class for GEAR - all other exceptions extend this.
class to merge two xml files.
bool setFile1(const std::string &fileName)
Sets first filename returns true if file can be read.
bool setFile2(const std::string &fileName)
Sets second filename returns true if file can be read.