blob: ada134aa9f22aab4caf44a02a3a421af2df5bc24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#include "xsd2c.h"
#include "formatter.h"
#include "tr.h"
#include "obj.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;
}
if (!xsdInitTrModule(xsdNode))
return 1;
if (!xsdInitObjModule(xsdNode))
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);
}
|