summaryrefslogtreecommitdiffstats
path: root/xsd2c
diff options
context:
space:
mode:
authorGravatar snowdrop2004-06-03 20:23:02 +0000
committerGravatar snowdrop2004-06-03 20:23:02 +0000
commit55cefa05d48152404dbec4eff03339342265f931 (patch)
treea0c53be98947aa00f9b94443b4c265444ebaa32a /xsd2c
parentce7dac10cbfaf1f0aa68350f0993184561e1b7b5 (diff)
downloadcsoap-55cefa05d48152404dbec4eff03339342265f931.tar.gz
csoap-55cefa05d48152404dbec4eff03339342265f931.tar.bz2
fixed typeregistry bug
example : #include "s0:Dictionary.h" instead of #include "Dictionary.h"
Diffstat (limited to 'xsd2c')
-rw-r--r--xsd2c/formatter.c20
-rw-r--r--xsd2c/obj.c5
-rw-r--r--xsd2c/tr.c11
-rw-r--r--xsd2c/tr.h6
-rw-r--r--xsd2c/xsd2c.c6
5 files changed, 32 insertions, 16 deletions
diff --git a/xsd2c/formatter.c b/xsd2c/formatter.c
index 50b81f9..0d46f11 100644
--- a/xsd2c/formatter.c
+++ b/xsd2c/formatter.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: formatter.c,v 1.2 2004/06/03 13:14:35 snowdrop Exp $
+ * $Id: formatter.c,v 1.3 2004/06/03 20:23:02 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -75,6 +75,7 @@ void writeComplexTypeHeaderFile(FILE* f, HCOMPLEXTYPE obj)
HFIELD field;
char buffer[1054];
+
if (obj == NULL)
{
fprintf(stderr, "Can not declare a null object!\n");
@@ -91,14 +92,15 @@ void writeComplexTypeHeaderFile(FILE* f, HCOMPLEXTYPE obj)
{
if (trGetBuildInFlag(field->type) == 0)
{
- fprintf(f, "#include \"%s.h\"\n", field->type); /* _xsd*/
+
+ fprintf(f, "#include \"%s.h\"\n", trXSDParseNs(field->type)); /* _xsd*/
}
field = field->next;
}
if (obj->base_type != NULL)
{
- fprintf(f, "#include \"%s.h\"\n", obj->base_type);/* _xsd*/
+ fprintf(f, "#include \"%s.h\"\n", trXSDParseNs(obj->base_type));/* _xsd*/
}
/* include libxml library */
@@ -892,7 +894,7 @@ static void writeCodeSaxSerialize(FILE* f, HCOMPLEXTYPE obj)
{
fprintf(f, "\tif (%s_cur->value)\n", field->name);
sprintf(buffer, "%s_Sax_Serialize(%s_cur->value, \"%s\", OnStartElement, OnCharacters, OnEndElement, userData);\n",
- field->type, field->name, field->name);
+ trXSDParseNs(field->type), field->name, field->name);
fprintf(f, "\t\t%s\n", buffer);
}
@@ -929,7 +931,7 @@ static void writeCodeSaxSerialize(FILE* f, HCOMPLEXTYPE obj)
{
fprintf(f, "\tif (obj->%s)\n", field->name);
sprintf(buffer, "%s_Sax_Serialize(obj->%s, \"%s\", OnStartElement, OnCharacters, OnEndElement, userData);",
- field->type, field->name, field->name);
+ trXSDParseNs(field->type), field->name, field->name);
fprintf(f, "\t%s\n", buffer );
}
}
@@ -1042,7 +1044,7 @@ static void writeCodeBaseOnEndElement(FILE* f, HCOMPLEXTYPE obj)
{
fprintf(f, "\tif (%s_cur->value)\n", field->name);
sprintf(buffer, "%s_Sax_Serialize(%s_cur->value, \"%s\", bsce->OnStartElement, bsce->OnCharacters, bsce->OnEndElement, bsce->userData);\n",
- field->type, field->name, field->name);
+ trXSDParseNs(field->type), field->name, field->name);
fprintf(f, "\t\t%s\n", buffer);
}
@@ -1079,7 +1081,7 @@ static void writeCodeBaseOnEndElement(FILE* f, HCOMPLEXTYPE obj)
{
fprintf(f, "\tif (obj->%s)\n", field->name);
sprintf(buffer, "%s_Sax_Serialize(obj->%s, \"%s\", bsce->OnStartElement, bsce->OnCharacters, bsce->OnEndElement, bsce->userData);",
- field->type, field->name, field->name);
+ trXSDParseNs(field->type), field->name, field->name);
fprintf(f, "\t%s\n", buffer );
}
}
@@ -1217,9 +1219,9 @@ static void writeCodeDeserialize(FILE* f, HCOMPLEXTYPE obj)
else
{
if (field->maxOccurs > 1 || field->maxOccurs == -1) {
- fprintf(f, "\t\t\t%s_Add_%s( obj, %s_Deserialize(cur) );\n", field->parentObj->type, field->name, field->type);
+ fprintf(f, "\t\t\t%s_Add_%s( obj, %s_Deserialize(cur) );\n", field->parentObj->type, field->name, trXSDParseNs(field->type));
} else {
- fprintf(f, "\t\t\t%s_Set_%s( obj, %s_Deserialize(cur) );\n", field->parentObj->type, field->name, field->type);
+ fprintf(f, "\t\t\t%s_Set_%s( obj, %s_Deserialize(cur) );\n", field->parentObj->type, field->name, trXSDParseNs(field->type));
}
}
diff --git a/xsd2c/obj.c b/xsd2c/obj.c
index 804cf4f..1107807 100644
--- a/xsd2c/obj.c
+++ b/xsd2c/obj.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: obj.c,v 1.2 2004/06/02 14:57:23 snowdrop Exp $
+ * $Id: obj.c,v 1.3 2004/06/03 20:23:03 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -23,6 +23,7 @@
******************************************************************/
#include "obj.h"
#include "tr.h"
+#include "util.h"
#include <stdio.h>
#include <string.h>
@@ -149,7 +150,7 @@ static
HFIELD fieldCreate(const char* name, const char* type, int flag, int mino, int maxo, HCOMPLEXTYPE parentObj)
{
HFIELD field;
-
+
field = (HFIELD)malloc(sizeof(struct FIELD));
field->name = (char*)malloc(strlen(name)+1);
field->type = (char*)malloc(strlen(type)+1);
diff --git a/xsd2c/tr.c b/xsd2c/tr.c
index 5756e91..7166d72 100644
--- a/xsd2c/tr.c
+++ b/xsd2c/tr.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: tr.c,v 1.1 2004/06/02 11:17:03 snowdrop Exp $
+ * $Id: tr.c,v 1.2 2004/06/03 20:23:03 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -180,6 +180,15 @@ void trRegisterTypeNS(const char* ns, const char* xsdType, const char* cType)
tr_tail = reg;
}
+char* trXSDParseNs(const char* xsdType)
+{
+ int c = 0;
+ while (xsdType[c] != '\0' ) {
+ if (xsdType[c] == ':') return &xsdType[++c];
+ c++;
+ }
+ return xsdType;
+}
void trRegisterListType(const char* xsdType, const char* cType)
{
diff --git a/xsd2c/tr.h b/xsd2c/tr.h
index 1beb3fa..fe6cb60 100644
--- a/xsd2c/tr.h
+++ b/xsd2c/tr.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: tr.h,v 1.1 2004/06/02 11:17:03 snowdrop Exp $
+ * $Id: tr.h,v 1.2 2004/06/03 20:23:03 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -19,7 +19,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Email: ayaz@jprogrammet.net
+ * Email: ayaz@jprogrammer.net
******************************************************************/
#ifndef XSD2C_TR_H
#define XSD2C_TR_H
@@ -41,4 +41,6 @@ void trRegisterListTypeNS(const char* ns, const char* xsdType, const char* cType
int trGetBuildInFlag(const char* xsdType);
+char* trXSDParseNs(const char* xsdType);
+
#endif
diff --git a/xsd2c/xsd2c.c b/xsd2c/xsd2c.c
index 8c61bba..d8d5cb1 100644
--- a/xsd2c/xsd2c.c
+++ b/xsd2c/xsd2c.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: xsd2c.c,v 1.5 2004/06/03 13:14:35 snowdrop Exp $
+ * $Id: xsd2c.c,v 1.6 2004/06/03 20:23:03 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -463,6 +463,7 @@ HCOMPLEXTYPE xsdProcComplexType(xmlNodePtr node, const char* type)
xsdKeyword keyword;
HCOMPLEXTYPE ct;
+
if (!type)
name = xmlGetProp(node, ATTR_NAME_STR);
else {
@@ -566,7 +567,7 @@ void runGenerator(xmlNodePtr xsdRoot)
xsdProcComplexType(cur, NULL);
} else if (xsdGetKeyword(cur) == XSD_ELEMENT) {
-
+
type = xmlGetProp(cur, "name");
if (type == NULL) {
fprintf(stderr, "WARNING: Element found without name ('%s')\n", cur->name);
@@ -579,6 +580,7 @@ void runGenerator(xmlNodePtr xsdRoot)
}
+ /*xsdProcElement(..., cur);*/
}
cur = cur->next;