diff options
author | snowdrop | 2004-06-03 08:38:34 +0000 |
---|---|---|
committer | snowdrop | 2004-06-03 08:38:34 +0000 |
commit | dba04a85c15cf13cae1e3cb1e47e586e2fabc039 (patch) | |
tree | 0579333dd29bc9c4320ec9fabddd056a9a408353 | |
parent | ca48b432a8e08a8277832831fa2d193cee0152a6 (diff) | |
download | csoap-dba04a85c15cf13cae1e3cb1e47e586e2fabc039.tar.gz csoap-dba04a85c15cf13cae1e3cb1e47e586e2fabc039.tar.bz2 |
initial import
-rwxr-xr-x | xsd2c/main.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/xsd2c/main.c b/xsd2c/main.c new file mode 100755 index 0000000..6e866c6 --- /dev/null +++ b/xsd2c/main.c @@ -0,0 +1,62 @@ +#include "xsd2c.h" +#include "formatter.h" + +#include <string.h> + + +void usage(const char* execName); + +int main(int argc, char *argv[]) +{ + int i; + char outDir[1054]; + xmlNodePtr xsdNode = NULL; + char fname[255]; + int wsdl = 0; + + if (argc < 2) { + usage(argv[0]); + return 1; + } + + + strcpy(outDir, "."); + + for (i=1;i<argc;i++) + { + if (!strcmp(argv[i], "-d")) + if (i==argc-1) usage(argv[0]); + else strcpy(outDir, argv[++i]); + else if (!strcmp(argv[i], "-S")) + formatter_generate_sax_serializer = 1; + else if (!strcmp(argv[i], "-wsdl")) + wsdl = 1; + else strcpy(fname, argv[i]); + } + + + if (wsdl) + xsdNode = wsdlLoadFile(fname); + else + xsdNode = xsdLoadFile(fname); + + if (xsdNode == NULL) { + fprintf(stderr, "can not load xsd file!\n"); + return 1; + } + + xsdEngineRun(xsdNode, outDir); + + xmlFreeDoc(xsdNode->doc); + + return 0; +} + + + +void usage(const char* execName) +{ + printf("usage: %s [-d <destdir> -S -D] <xsd filename>\n", execName); +} + + |