cvs: pecl /soap php_schema.c php_sdl.c

From: Date: Fri, 09 Jan 2004 16:36:14 +0000
Subject: cvs: pecl /soap php_schema.c php_sdl.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-713@lists.php.net to get a copy of this message
dmitry Fri Jan 9 11:36:14 2004 EDT Modified files: /pecl/soap php_schema.c php_sdl.c Log: BUGFIX: WSDL support (complexType/complexContent/restiction/atttibute) Index: pecl/soap/php_schema.c diff -u pecl/soap/php_schema.c:1.11 pecl/soap/php_schema.c:1.12 --- pecl/soap/php_schema.c:1.11 Fri Jan 9 10:31:09 2004 +++ pecl/soap/php_schema.c Fri Jan 9 11:36:13 2004 @@ -121,6 +121,7 @@ } ht = cur_type->elements; smart_str_appends(&key, cur_type->name); + smart_str_0(&key); } zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr); @@ -316,22 +317,30 @@ if(trav->type == XML_ELEMENT_NODE) { if(!strcmp(trav->name, "group")) { schema_group(sdl, tsn, trav, cur_type); - return TRUE; + break; } else if(!strcmp(trav->name, "all")) { schema_all(sdl, tsn, trav, cur_type); - return TRUE; + break; } else if(!strcmp(trav->name, "choice")) { schema_choice(sdl, tsn, trav, cur_type); - return TRUE; + break; } else if(!strcmp(trav->name, "sequence")) { schema_sequence(sdl, tsn, trav, cur_type); - return TRUE; + break; } else if(!strcmp(trav->name, "attribute")) { schema_attribute(sdl, tsn, trav, cur_type); } } trav = trav->next; } + while (trav != NULL) { + if(trav->type == XML_ELEMENT_NODE) { + if(!strcmp(trav->name, "attribute")) { + schema_attribute(sdl, tsn, trav, cur_type); + } + } + trav = trav->next; + } return TRUE; } @@ -773,6 +782,7 @@ } ht = cur_type->elements; smart_str_appends(&key, newType->name); + smart_str_0(&key); } zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr); @@ -1055,6 +1065,7 @@ smart_str_free(&key); return TRUE; } + smart_str_free(&key); } zend_hash_next_index_insert(cur_type->attributes, &newAttr, sizeof(sdlAttributePtr), NULL); Index: pecl/soap/php_sdl.c diff -u pecl/soap/php_sdl.c:1.12 pecl/soap/php_sdl.c:1.13 --- pecl/soap/php_sdl.c:1.12 Fri Jan 9 10:31:09 2004 +++ pecl/soap/php_sdl.c Fri Jan 9 11:36:13 2004 @@ -280,6 +280,7 @@ int dimension = 1; int* dims; xmlNodePtr xmlParam; + sdlTypePtr elementType; encodePtr enc = NULL; TSRMLS_FETCH(); @@ -368,8 +369,47 @@ efree(value); if (ns) efree(ns); + } else if (type->elements && + zend_hash_num_elements(type->elements) == 1 && + (elementType = *(sdlTypePtr*)type->elements->pListHead->pData) != NULL && + elementType->encode && elementType->encode->details.type_str) { + char* ns = elementType->encode->details.ns; + if (ns) { + if (strcmp(ns,XSD_NAMESPACE) == 0) { + smart_str_appendl(&array_type_and_size, XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX) - 1); + smart_str_appendc(&array_type_and_size, ':'); + } else { + smart_str *prefix = encode_new_ns(); + smart_str smart_ns = {0}; + + smart_str_appendl(&smart_ns, "xmlns:", sizeof("xmlns:") - 1); + smart_str_appendl(&smart_ns, prefix->c, prefix->len); + smart_str_0(&smart_ns); + xmlSetProp(xmlParam, smart_ns.c, ns); + smart_str_free(&smart_ns); + + smart_str_appends(&array_type_and_size, prefix->c); + smart_str_appendc(&array_type_and_size, ':'); + smart_str_free(prefix); + efree(prefix); + } + } + enc = elementType->encode; + smart_str_appends(&array_type_and_size, elementType->encode->details.type_str); + smart_str_free(&array_type); + smart_str_appendc(&array_type_and_size, '['); + smart_str_append_long(&array_type_and_size, i); + smart_str_appendc(&array_type_and_size, ']'); + smart_str_0(&array_type_and_size); + + dims = emalloc(sizeof(int)*dimension); + dims[0] = i; } else { - smart_str_appends(&array_type_and_size, type->name); + smart_str array_type = {0}; + get_array_type(data, &array_type TSRMLS_CC); + enc = get_encoder_ex(SOAP_GLOBAL(sdl), array_type.c); + smart_str_append(&array_type_and_size, &array_type); + smart_str_free(&array_type); smart_str_appendc(&array_type_and_size, '['); smart_str_append_long(&array_type_and_size, i); smart_str_appendc(&array_type_and_size, ']'); @@ -439,6 +479,7 @@ smart_str_appends(&key, ns); smart_str_appendc(&key, ':'); smart_str_appends(&key, name); + smart_str_0(&key); zend_hash_find(sdl->bindings, key.c, key.len, (void **)&binding);

« previous php.pecl.cvs (#713) next »