summaryrefslogtreecommitdiffstats
path: root/xsd2c
diff options
context:
space:
mode:
Diffstat (limited to 'xsd2c')
-rw-r--r--xsd2c/xsd2c.c50
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;
}