diff options
author | snowdrop | 2004-06-02 15:35:04 +0000 |
---|---|---|
committer | snowdrop | 2004-06-02 15:35:04 +0000 |
commit | cd3a4d82e8e1dddd6470fc564c7d54580912f739 (patch) | |
tree | ab06a6c38690f12979f7562e265999a4237558f1 /wsdl2c | |
parent | a26c02b7222c99a5ebfa87eed5469c467e484e24 (diff) | |
download | csoap-cd3a4d82e8e1dddd6470fc564c7d54580912f739.tar.gz csoap-cd3a4d82e8e1dddd6470fc564c7d54580912f739.tar.bz2 |
integrate wsdl2c and xsd2c projects
Diffstat (limited to 'wsdl2c')
-rwxr-xr-x | wsdl2c/wsdl2c.c | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/wsdl2c/wsdl2c.c b/wsdl2c/wsdl2c.c index 85daa23..43d0a3c 100755 --- a/wsdl2c/wsdl2c.c +++ b/wsdl2c/wsdl2c.c @@ -1,8 +1,9 @@ #include <libxml/xpath.h> #include <xsd2c/xsd2c.h> #include <xsd2c/util.h> /* parseNS */ - - +#include <xsd2c/formatter.h> /* formatter sax serializer */ +#include <xsd2c/obj.h> /* formatter sax serializer */ +#include <string.h> xmlXPathObjectPtr xpath_eval(xmlDocPtr doc, const char *xpath) { @@ -423,25 +424,58 @@ void wsdlParse(xmlDocPtr doc) } + +static +void usage(const char* execname); + int main(int argc, char *argv[]) { xmlDocPtr doc; xmlNodePtr cur; xmlNodePtr node; + xmlNodePtr xsdRoot; xmlNsPtr default_ns; + int i; + char outDir[1054]; + char fname[255]; if (argc < 2) { - fprintf(stderr, "usage: %s <wsdl file>\n", argv[0]); + usage(argv[0]); return 1; } - doc = xmlParseFile(argv[1]); - if (doc == NULL ) { - fprintf(stderr,"Document not parsed successfully. \n"); - 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 strcpy(fname, argv[i]); } + + xsdRoot = wsdlLoadFile(fname); + + if (xsdRoot == NULL ) + { + fprintf(stderr,"No Schema data found\n"); + doc = xmlParseFile(fname); + if (doc == NULL) + { + fprintf(stderr,"Can not parse document\n"); + return 1; + } + } + else + { + doc = xsdRoot->doc; + } + node = xmlDocGetRootElement(doc); if (node == NULL) { @@ -458,9 +492,24 @@ int main(int argc, char *argv[]) } + if (xsdEngineRun(xsdRoot, outDir)) { + fprintf(stderr, "xsd2c engine error\n"); + return 1; + } + wsdlParse(doc); + trFreeModule(); + objFreeModule(); + xmlFreeDoc(doc); return 0; } + + +static +void usage(const char* execname) +{ + fprintf(stderr, "usage: %s -d dest <wsdl file>\n", execname); +}
\ No newline at end of file |