summaryrefslogtreecommitdiff
path: root/ext/soap/php_schema.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2004-01-19 07:22:53 +0000
committerDmitry Stogov <dmitry@php.net>2004-01-19 07:22:53 +0000
commita68777e9545a505635f60bd881c5771e36cd4e69 (patch)
tree3f23f09962be50125a52d1973f14507ae0f373fb /ext/soap/php_schema.c
parent608db4728b56eaab9bcbc931d3762dfd2fbcee71 (diff)
downloadphp-git-a68777e9545a505635f60bd881c5771e36cd4e69.tar.gz
XML Scheam support
Diffstat (limited to 'ext/soap/php_schema.c')
-rw-r--r--ext/soap/php_schema.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 04b274bdbe..7621e1a5f3 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -50,6 +50,10 @@ int load_schema(sdlPtr sdl,xmlNodePtr schema)
sdl->types = malloc(sizeof(HashTable));
zend_hash_init(sdl->types, 0, NULL, delete_type, 1);
}
+ if (!sdl->elements) {
+ sdl->elements = malloc(sizeof(HashTable));
+ zend_hash_init(sdl->elements, 0, NULL, delete_type, 1);
+ }
tns = get_attribute(schema->properties, "targetNamespace");
@@ -866,7 +870,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
newType->max_occurs = 1;
if (cur_type == NULL) {
- addHash = sdl->types;
+ addHash = sdl->elements;
smart_str_appends(&key, newType->namens);
smart_str_appendc(&key, ':');
smart_str_appends(&key, newType->name);
@@ -926,17 +930,10 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
xmlNsPtr nsptr;
parse_namespace(curattr->children->content, &cptype, &str_ns);
-/*
- if (str_ns) {
-*/
- nsptr = xmlSearchNs(element->doc, element, str_ns);
-/*
- } else {
- nsptr = xmlSearchNsByHref(element->doc, element, ns->children->content);
+ nsptr = xmlSearchNs(element->doc, element, str_ns);
+ if (nsptr != NULL) {
+ cur_type->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, (char *)cptype);
}
-*/
-
- cur_type->encode = get_create_encoder(sdl, cur_type, (char *)nsptr->href, (char *)cptype);
if (str_ns) {efree(str_ns);}
if (cptype) {efree(cptype);}
}
@@ -1037,16 +1034,20 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdl
parse_namespace(newAttr->ref, &value, &prefix);
ns = xmlSearchNs(attrType->doc, attrType, prefix);
- smart_str_appends(&key, ns->href);
- smart_str_appendc(&key, ':');
+ if (ns != NULL) {
+ smart_str_appends(&key, ns->href);
+ smart_str_appendc(&key, ':');
+ }
smart_str_appends(&key, value);
if (value) {efree(value);}
if (prefix) {efree(prefix);}
} else {
ns = node_find_ns(attrType);
- smart_str_appends(&key, ns->href);
- smart_str_appendc(&key, ':');
+ if (ns != NULL) {
+ smart_str_appends(&key, ns->href);
+ smart_str_appendc(&key, ':');
+ }
smart_str_appends(&key, newAttr->name);
}