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 /xsd2c | |
parent | a26c02b7222c99a5ebfa87eed5469c467e484e24 (diff) | |
download | csoap-cd3a4d82e8e1dddd6470fc564c7d54580912f739.tar.gz csoap-cd3a4d82e8e1dddd6470fc564c7d54580912f739.tar.bz2 |
integrate wsdl2c and xsd2c projects
Diffstat (limited to 'xsd2c')
-rw-r--r-- | xsd2c/xsd2c.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/xsd2c/xsd2c.c b/xsd2c/xsd2c.c index 37b3497..80660c3 100644 --- a/xsd2c/xsd2c.c +++ b/xsd2c/xsd2c.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: xsd2c.c,v 1.2 2004/06/02 14:57:23 snowdrop Exp $ + * $Id: xsd2c.c,v 1.3 2004/06/02 15:35:07 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -628,32 +628,36 @@ int writeSource(HCOMPLEXTYPE ct) int xsdInitTrModule(xmlNodePtr xsdNode) { - xmlNsPtr ns; - - ns = xmlSearchNsByHref(xsdNode->doc, xsdNode, "http://www.w3.org/2001/XMLSchema"); - if (ns == NULL) { - fprintf(stderr, "XML Schema namespace not found!\n"); - return 0; - } - - if (ns->prefix == NULL) { - fprintf(stderr, "XML Schema namespace not found!\n"); - return 0; + xmlNsPtr ns = NULL; + + if (xsdNode != NULL) { + ns = xmlSearchNsByHref(xsdNode->doc, xsdNode, "http://www.w3.org/2001/XMLSchema"); + if (ns == NULL) { + fprintf(stderr, "XML Schema namespace not found!\n"); + return 0; + } + + if (ns->prefix == NULL) { + fprintf(stderr, "XML Schema namespace not found!\n"); + return 0; + } + fprintf(stdout, "XMLSchema namespace prefix: '%s'\n", ns->prefix); + trInitModule(ns->prefix); + } else { + trInitModule("ts"); } - fprintf(stdout, "XMLSchema namespace prefix: '%s'\n", ns->prefix); - trInitModule(ns->prefix); - return 1; } int xsdInitObjModule(xmlNodePtr xsdNode) { - xmlChar *tns; + xmlChar *tns = NULL; xmlNsPtr ns; - tns = xmlGetProp(xsdNode, (const xmlChar*)"targetNamespace"); + if (xsdNode != NULL) + tns = xmlGetProp(xsdNode, (const xmlChar*)"targetNamespace"); if (tns == NULL) { @@ -695,13 +699,13 @@ int xsdEngineRun(xmlNodePtr xsdNode, const char* destDir) mkdir(destDir, S_IRUSR|S_IWUSR|S_IXUSR | S_IRGRP|S_IWGRP|S_IXGRP | S_IROTH|S_IXOTH ); - - runGenerator(xsdNode); - objRegistryEnumComplexType(declareStructs); - objRegistryEnumComplexType(writeSource); - trFreeModule(); - objFreeModule(); + if (xsdNode != NULL) { + runGenerator(xsdNode); + objRegistryEnumComplexType(declareStructs); + objRegistryEnumComplexType(writeSource); + } + return 0; } |