diff options
author | snowdrop | 2004-06-02 11:17:03 +0000 |
---|---|---|
committer | snowdrop | 2004-06-02 11:17:03 +0000 |
commit | b6d27351412b20656f670cea3ae969f5c30c634b (patch) | |
tree | 4c446d635646a1c60d56cd16cb8b298c9177aef2 /examples/xsd2c | |
parent | 64a8019425b6cc6d9e957281c9aeb7c968693b1d (diff) | |
download | csoap-b6d27351412b20656f670cea3ae969f5c30c634b.tar.gz csoap-b6d27351412b20656f670cea3ae969f5c30c634b.tar.bz2 |
initial import
Diffstat (limited to 'examples/xsd2c')
-rw-r--r-- | examples/xsd2c/utils.c | 37 | ||||
-rw-r--r-- | examples/xsd2c/utils.h | 11 |
2 files changed, 48 insertions, 0 deletions
diff --git a/examples/xsd2c/utils.c b/examples/xsd2c/utils.c new file mode 100644 index 0000000..0be002b --- /dev/null +++ b/examples/xsd2c/utils.c @@ -0,0 +1,37 @@ + +#include "utils.h" + + +int Writer_Tab = 0; +int Writer_Ret = 0; + +void Writer_StartElement(const char* element_name, int attr_count, char **keys, char **values, void* userData) +{ + int i, j; + if (Writer_Ret) printf("\n"); + for (j=0;j<Writer_Tab;j++) printf("\t"); + printf("<%s", element_name); + for (i=0;i<attr_count;i++) + { + printf(" %s = \"%s\"", keys[i], values[i]); + } + printf(">"); + Writer_Tab++; + Writer_Ret = 1; +} + +void Writer_Characters(const char* element_name, const char* chars, void* userData) +{ + printf("%s", chars); +} + +void Writer_EndElement(const char* element_name, void* userData) +{ + int j; + Writer_Tab--; + if (!Writer_Ret) + for (j=0;j<Writer_Tab;j++) printf("\t"); + printf("</%s>\n", element_name); + Writer_Ret = 0; +} + diff --git a/examples/xsd2c/utils.h b/examples/xsd2c/utils.h new file mode 100644 index 0000000..17a2140 --- /dev/null +++ b/examples/xsd2c/utils.h @@ -0,0 +1,11 @@ + +#ifndef _EX_UTILS_H_ +#define _EX_UTILS_H_ + + +void Writer_StartElement(const char* element_name, int attr_count, char **keys, char **values, void* userData); +void Writer_Characters(const char* element_name, const char* chars, void* userData); +void Writer_EndElement(const char* element_name, void* userData); + + +#endif |