nsptr = xmlSearchNs(groupType->doc, groupType, BAD_CAST(ns));
if (nsptr != NULL) {
smart_str_appends(&key, (char*)nsptr->href);
+ } else {
+ xmlAttrPtr ns = get_attribute(groupType->properties, "targetNamespace");
+ if (ns == NULL) {
+ ns = tns;
+ }
+ if (ns) {
+ smart_str_appends(&key, (char*)ns->children->content);
+ }
}
smart_str_appendc(&key, ':');
smart_str_appends(&key, type);
if (nsptr != NULL) {
smart_str_appends(&nscat, (char*)nsptr->href);
newType->namens = estrdup((char*)nsptr->href);
+ } else {
+ xmlAttrPtr ns = get_attribute(attrs, "targetNamespace");
+ if (ns == NULL) {
+ ns = tns;
+ }
+ if (ns) {
+ smart_str_appends(&nscat, (char*)ns->children->content);
+ }
}
smart_str_appendc(&nscat, ':');
smart_str_appends(&nscat, type);
if (nsptr != NULL) {
smart_str_appends(&key, (char*)nsptr->href);
newAttr->namens = estrdup((char*)nsptr->href);
+ } else {
+ xmlAttrPtr ns = get_attribute(attrType->properties, "targetNamespace");
+ if (ns == NULL) {
+ ns = tns;
+ }
+ if (ns) {
+ smart_str_appends(&key, (char*)ns->children->content);
+ }
}
smart_str_appendc(&key, ':');
smart_str_appends(&key, attr_name);
}
}
+static void* schema_find_by_ref(HashTable *ht, char *ref)
+{
+ void **tmp;
+
+ if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
+ return tmp;
+ } else {
+ ref = strrchr(ref, ':');
+ if (ref) {
+ if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
+ return tmp;
+ }
+ }
+ }
+ return NULL;
+}
+
static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
{
sdlAttributePtr *tmp;
if (attr->ref != NULL) {
if (ctx->attributes != NULL) {
- if (zend_hash_find(ctx->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
+ tmp = (sdlAttributePtr*)schema_find_by_ref(ctx->attributes, attr->ref);
+ if (tmp) {
schema_attribute_fixup(ctx, *tmp);
if ((*tmp)->name != NULL && attr->name == NULL) {
attr->name = estrdup((*tmp)->name);
if (attr->ref != NULL) {
if (ctx->attributeGroups != NULL) {
- if (zend_hash_find(ctx->attributeGroups, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
+ tmp = (sdlTypePtr*)schema_find_by_ref(ctx->attributeGroups, attr->ref);
+ if (tmp) {
if ((*tmp)->attributes) {
zend_hash_internal_pointer_reset((*tmp)->attributes);
while (zend_hash_get_current_data((*tmp)->attributes,(void**)&tmp_attr) == SUCCESS) {
model->kind = XSD_CONTENT_GROUP;
model->u.group = (*tmp);
} else {
- soap_error0(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute");
+ soap_error1(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute '%s'", model->u.group_ref);
}
break;
}
if (type->ref != NULL) {
if (ctx->sdl->elements != NULL) {
- if (zend_hash_find(ctx->sdl->elements, type->ref, strlen(type->ref)+1, (void**)&tmp) == SUCCESS) {
+ tmp = (sdlTypePtr*)schema_find_by_ref(ctx->sdl->elements, type->ref);
+ if (tmp) {
type->kind = (*tmp)->kind;
type->encode = (*tmp)->encode;
if ((*tmp)->nillable) {
} else if (strcmp(type->ref, SCHEMA_NAMESPACE ":schema") == 0) {
type->encode = get_conversion(XSD_ANYXML);
} else {
- soap_error0(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute");
+ soap_error1(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute '%s'", type->ref);
}
}
efree(type->ref);