20#include "libxml/uri.h"
22static int schema_simpleType(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType,
sdlTypePtr cur_type);
23static int schema_complexType(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType,
sdlTypePtr cur_type);
24static int schema_list(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType,
sdlTypePtr cur_type);
25static int schema_union(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType,
sdlTypePtr cur_type);
26static int schema_simpleContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpCompType,
sdlTypePtr cur_type);
27static int schema_restriction_simpleContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr restType,
sdlTypePtr cur_type,
int simpleType);
28static int schema_restriction_complexContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr restType,
sdlTypePtr cur_type);
29static int schema_extension_simpleContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType,
sdlTypePtr cur_type);
30static int schema_extension_complexContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType,
sdlTypePtr cur_type);
55 smart_str_appends(&nscat, (
char*)ns);
56 smart_str_appendc(&nscat,
':');
57 smart_str_appends(&nscat, (
char*)
type);
59 if ((enc_ptr = zend_hash_find_ptr(
sdl->encoders, nscat.
s)) !=
NULL) {
85 if (enc_ptr ==
NULL) {
86 zend_hash_update_ptr(
sdl->encoders, nscat.
s, enc);
88 smart_str_free(&nscat);
96 enc = create_encoder(
sdl, cur_type, ns,
type);
102static void requestify_string(xmlChar **str) {
103 xmlChar *
copy = (xmlChar *)
estrdup((
const char *) *str);
108static void schema_load_file(
sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, xmlAttrPtr tns,
int import) {
109 if (location !=
NULL &&
110 !zend_hash_str_exists(&ctx->
docs, (
char*)location, xmlStrlen(location))) {
120 requestify_string(&location);
123 schema =
get_node(doc->children,
"schema");
124 if (schema ==
NULL) {
125 requestify_string(&location);
129 new_tns =
get_attribute(schema->properties,
"targetNamespace");
131 if (ns !=
NULL && (new_tns ==
NULL || xmlStrcmp(ns->children->content, new_tns->children->content) != 0)) {
132 requestify_string(&location);
133 if (new_tns ==
NULL) {
135 soap_error2(
E_ERROR,
"Parsing Schema: can't import schema from '%s', missing 'targetNamespace', expected '%s'", location, ns->children->content);
138 const char *target_ns_copy =
estrdup((
const char *) new_tns->children->content);
140 soap_error3(
E_ERROR,
"Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s', expected '%s'", location, target_ns_copy, ns->children->content);
143 if (ns ==
NULL && new_tns !=
NULL) {
144 requestify_string(&location);
146 const char *target_ns_copy =
estrdup((
const char *) new_tns->children->content);
148 soap_error2(
E_ERROR,
"Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s', expected no 'targetNamespace'", location, target_ns_copy);
151 new_tns =
get_attribute(schema->properties,
"targetNamespace");
152 if (new_tns ==
NULL) {
154 xmlSetProp(schema, BAD_CAST(
"targetNamespace"), tns->children->content);
156 }
else if (tns !=
NULL && xmlStrcmp(tns->children->content, new_tns->children->content) != 0) {
157 requestify_string(&location);
159 soap_error1(
E_ERROR,
"Parsing Schema: can't include schema from '%s', different 'targetNamespace'", location);
162 zend_hash_str_add_ptr(&ctx->
docs, (
char*)location, xmlStrlen(location), doc);
171 xmlChar *base = xmlNodeGetBase(attribute->doc, attribute->parent);
174 uri = xmlBuildURI(attribute->children->content, attribute->doc->URL);
176 uri = xmlBuildURI(attribute->children->content, base);
223 tns = xmlSetProp(schema, BAD_CAST(
"targetNamespace"), BAD_CAST(
""));
224 xmlNewNs(schema, BAD_CAST(
""),
NULL);
227 trav = schema->children;
228 while (trav !=
NULL) {
232 location =
get_attribute(trav->properties,
"schemaLocation");
233 if (location ==
NULL) {
237 schema_load_file(ctx,
NULL, uri, tns, 0);
244 location =
get_attribute(trav->properties,
"schemaLocation");
245 if (location ==
NULL) {
249 schema_load_file(ctx,
NULL, uri, tns, 0);
255 xmlAttrPtr ns, location;
259 location =
get_attribute(trav->properties,
"schemaLocation");
261 if (ns !=
NULL && tns !=
NULL && xmlStrcmp(ns->children->content, tns->children->content) == 0) {
263 soap_error1(
E_ERROR,
"Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'", location->children->content);
265 soap_error0(
E_ERROR,
"Parsing Schema: can't import schema. Namespace must not match the enclosing schema 'targetNamespace'");
271 schema_load_file(ctx, ns, uri, tns, 1);
272 if (uri !=
NULL) {xmlFree(uri);}
288 while (trav !=
NULL) {
290 schema_simpleType(ctx->
sdl, tns, trav,
NULL);
292 schema_complexType(ctx->
sdl, tns, trav,
NULL);
296 schema_attributeGroup(ctx->
sdl, tns, trav,
NULL, ctx);
300 schema_attribute(ctx->
sdl, tns, trav,
NULL, ctx);
322static int schema_simpleType(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType,
sdlTypePtr cur_type)
327 ns =
get_attribute(simpleType->properties,
"targetNamespace");
333 if (cur_type !=
NULL) {
348 ptr = zend_hash_next_index_insert_ptr(
sdl->types, newType);
364 zend_hash_next_index_insert_ptr(
sdl->encoders, cur_type->
encode);
377 if (cur_type ==
NULL) {
378 ptr = zend_hash_next_index_insert_ptr(
sdl->types, newType);
388 create_encoder(
sdl, cur_type, ns->children->content,
name->children->content);
393 trav = simpleType->children;
400 schema_restriction_simpleContent(
sdl, tns, trav, cur_type, 1);
404 schema_list(
sdl, tns, trav, cur_type);
408 schema_union(
sdl, tns, trav, cur_type);
414 soap_error0(
E_ERROR,
"Parsing Schema: expected <restriction>, <list> or <union> in simpleType");
431static int schema_list(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType,
sdlTypePtr cur_type)
437 if (itemType !=
NULL) {
443 nsptr = xmlSearchNs(listType->doc, listType, BAD_CAST(ns));
453 newType->
encode = get_create_encoder(
sdl, newType, nsptr->href, BAD_CAST(
type));
459 zend_hash_next_index_insert_ptr(cur_type->
elements, newType);
464 trav = listType->children;
472 if (itemType !=
NULL) {
473 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'itemType' attribute and subtype");
481 char *
res = zend_print_long_to_buf(
buf +
sizeof(
buf) - 1, zend_hash_num_elements(
sdl->types));
484 memcpy(str,
"anonymous",
sizeof(
"anonymous")-1);
494 zend_hash_next_index_insert_ptr(cur_type->
elements, newType);
496 schema_simpleType(
sdl, tns, trav, newType);
514static int schema_union(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType,
sdlTypePtr cur_type)
517 xmlAttrPtr memberTypes;
519 memberTypes =
get_attribute(unionType->properties,
"memberTypes");
520 if (memberTypes !=
NULL) {
526 str =
estrdup((
char*)memberTypes->children->content);
539 nsptr = xmlSearchNs(unionType->doc, unionType, BAD_CAST(ns));
549 newType->
encode = get_create_encoder(
sdl, newType, nsptr->href, BAD_CAST(
type));
555 zend_hash_next_index_insert_ptr(cur_type->
elements, newType);
564 trav = unionType->children;
569 while (trav !=
NULL) {
578 char *
res = zend_print_long_to_buf(
buf +
sizeof(
buf) - 1, zend_hash_num_elements(
sdl->types));
581 memcpy(str,
"anonymous",
sizeof(
"anonymous")-1);
591 zend_hash_next_index_insert_ptr(cur_type->
elements, newType);
593 schema_simpleType(
sdl, tns, trav, newType);
613static int schema_simpleContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpCompType,
sdlTypePtr cur_type)
617 trav = simpCompType->children;
625 schema_restriction_simpleContent(
sdl, tns, trav, cur_type, 0);
629 schema_extension_simpleContent(
sdl, tns, trav, cur_type);
635 soap_error0(
E_ERROR,
"Parsing Schema: expected <restriction> or <extension> in simpleContent");
658static int schema_restriction_simpleContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr restType,
sdlTypePtr cur_type,
int simpleType)
670 nsptr = xmlSearchNs(restType->doc, restType, BAD_CAST(ns));
672 cur_type->
encode = get_create_encoder(
sdl, cur_type, nsptr->href, BAD_CAST(
type));
675 }
else if (!simpleType) {
684 trav = restType->children;
690 schema_simpleType(
sdl, tns, trav, cur_type);
693 while (trav !=
NULL) {
719 schema_restriction_var_char(trav, &enumval);
733 while (trav !=
NULL) {
735 schema_attribute(
sdl, tns, trav, cur_type,
NULL);
737 schema_attributeGroup(
sdl, tns, trav, cur_type,
NULL);
763static int schema_restriction_complexContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr restType,
sdlTypePtr cur_type)
775 nsptr = xmlSearchNs(restType->doc, restType, BAD_CAST(ns));
777 cur_type->
encode = get_create_encoder(
sdl, cur_type, nsptr->href, BAD_CAST(
type));
784 trav = restType->children;
791 schema_group(
sdl, tns, trav, cur_type,
NULL);
794 schema_all(
sdl, tns, trav, cur_type,
NULL);
797 schema_choice(
sdl, tns, trav, cur_type,
NULL);
800 schema_sequence(
sdl, tns, trav, cur_type,
NULL);
804 while (trav !=
NULL) {
806 schema_attribute(
sdl, tns, trav, cur_type,
NULL);
808 schema_attributeGroup(
sdl, tns, trav, cur_type,
NULL);
827 xmlAttrPtr fixed,
value;
829 if ((*valptr) ==
NULL) {
835 (*valptr)->fixed =
FALSE;
837 if (!
strncmp((
char*)fixed->children->content,
"true",
sizeof(
"true")) ||
838 !
strncmp((
char*)fixed->children->content,
"1",
sizeof(
"1")))
839 (*valptr)->fixed =
TRUE;
847 (*valptr)->value = atoi((
char*)
value->children->content);
854 xmlAttrPtr fixed,
value;
856 if ((*valptr) ==
NULL) {
862 (*valptr)->fixed =
FALSE;
864 if (!
strncmp((
char*)fixed->children->content,
"true",
sizeof(
"true")) ||
865 !
strncmp((
char*)fixed->children->content,
"1",
sizeof(
"1"))) {
866 (*valptr)->fixed =
TRUE;
875 (*valptr)->value =
estrdup((
char*)
value->children->content);
888static int schema_extension_simpleContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType,
sdlTypePtr cur_type)
900 nsptr = xmlSearchNs(extType->doc, extType, BAD_CAST(ns));
902 cur_type->
encode = get_create_encoder(
sdl, cur_type, nsptr->href, BAD_CAST(
type));
909 trav = extType->children;
914 while (trav !=
NULL) {
916 schema_attribute(
sdl, tns, trav, cur_type,
NULL);
918 schema_attributeGroup(
sdl, tns, trav, cur_type,
NULL);
943static int schema_extension_complexContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType,
sdlTypePtr cur_type)
955 nsptr = xmlSearchNs(extType->doc, extType, BAD_CAST(ns));
957 cur_type->
encode = get_create_encoder(
sdl, cur_type, nsptr->href, BAD_CAST(
type));
964 trav = extType->children;
971 schema_group(
sdl, tns, trav, cur_type,
NULL);
974 schema_all(
sdl, tns, trav, cur_type,
NULL);
977 schema_choice(
sdl, tns, trav, cur_type,
NULL);
980 schema_sequence(
sdl, tns, trav, cur_type,
NULL);
984 while (trav !=
NULL) {
986 schema_attribute(
sdl, tns, trav, cur_type,
NULL);
988 schema_attributeGroup(
sdl, tns, trav, cur_type,
NULL);
1016 if (!
strncmp((
char*)
attr->children->content,
"unbounded",
sizeof(
"unbounded"))) {
1044 if (model ==
NULL) {
1045 cur_type->
model = newModel;
1047 zend_hash_next_index_insert_ptr(model->
u.
content, newModel);
1052 trav = all->children;
1057 while (trav !=
NULL) {
1059 schema_element(
sdl, tns, trav, cur_type, newModel);
1085 ns =
get_attribute(groupType->properties,
"targetNamespace");
1104 nsptr = xmlSearchNs(groupType->doc, groupType, BAD_CAST(ns));
1105 if (nsptr !=
NULL) {
1106 smart_str_appends(&
key, (
char*)nsptr->href);
1108 xmlAttrPtr ns =
get_attribute(groupType->properties,
"targetNamespace");
1113 smart_str_appends(&
key, (
char*)ns->children->content);
1116 smart_str_appendc(&
key,
':');
1117 smart_str_appends(&
key,
type);
1124 if (ns) {
efree(ns);}
1131 smart_str_appends(&
key, (
char*)ns->children->content);
1132 smart_str_appendc(&
key,
':');
1133 smart_str_appends(&
key, (
char*)
name->children->content);
1137 if (cur_type ==
NULL) {
1147 if (zend_hash_add_ptr(
sdl->groups,
key.s, newType) ==
NULL) {
1153 smart_str_free(&
key);
1155 if (model ==
NULL) {
1156 cur_type->
model = newModel;
1158 zend_hash_next_index_insert_ptr(model->
u.
content, newModel);
1166 trav = groupType->children;
1174 soap_error0(
E_ERROR,
"Parsing Schema: group has both 'ref' attribute and subcontent");
1177 schema_choice(
sdl, tns, trav, cur_type, newModel);
1181 soap_error0(
E_ERROR,
"Parsing Schema: group has both 'ref' attribute and subcontent");
1184 schema_sequence(
sdl, tns, trav, cur_type, newModel);
1188 soap_error0(
E_ERROR,
"Parsing Schema: group has both 'ref' attribute and subcontent");
1191 schema_all(
sdl, tns, trav, cur_type, newModel);
1220 if (model ==
NULL) {
1221 cur_type->
model = newModel;
1223 zend_hash_next_index_insert_ptr(model->
u.
content, newModel);
1228 trav = choiceType->children;
1233 while (trav !=
NULL) {
1235 schema_element(
sdl, tns, trav, cur_type, newModel);
1237 schema_group(
sdl, tns, trav, cur_type, newModel);
1239 schema_choice(
sdl, tns, trav, cur_type, newModel);
1241 schema_sequence(
sdl, tns, trav, cur_type, newModel);
1243 schema_any(
sdl, tns, trav, cur_type, newModel);
1270 if (model ==
NULL) {
1271 cur_type->
model = newModel;
1273 zend_hash_next_index_insert_ptr(model->
u.
content, newModel);
1278 trav = seqType->children;
1283 while (trav !=
NULL) {
1285 schema_element(
sdl, tns, trav, cur_type, newModel);
1287 schema_group(
sdl, tns, trav, cur_type, newModel);
1289 schema_choice(
sdl, tns, trav, cur_type, newModel);
1291 schema_sequence(
sdl, tns, trav, cur_type, newModel);
1293 schema_any(
sdl, tns, trav, cur_type, newModel);
1315 if (model !=
NULL) {
1323 zend_hash_next_index_insert_ptr(model->
u.
content, newModel);
1336static int schema_complexContent(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compCont,
sdlTypePtr cur_type)
1340 trav = compCont->children;
1348 schema_restriction_complexContent(
sdl, tns, trav, cur_type);
1352 schema_extension_complexContent(
sdl, tns, trav, cur_type);
1355 soap_error1(
E_ERROR,
"Parsing Schema: unexpected <%s> in complexContent", trav->name);
1358 soap_error0(
E_ERROR,
"Parsing Schema: <restriction> or <extension> expected in complexContent");
1361 soap_error1(
E_ERROR,
"Parsing Schema: unexpected <%s> in complexContent", trav->name);
1379static int schema_complexType(
sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType,
sdlTypePtr cur_type)
1382 xmlAttrPtr attrs,
name, ns;
1384 attrs = compType->properties;
1391 if (cur_type !=
NULL) {
1406 ptr = zend_hash_next_index_insert_ptr(
sdl->types, newType);
1422 zend_hash_next_index_insert_ptr(
sdl->encoders, cur_type->
encode);
1435 ptr = zend_hash_next_index_insert_ptr(
sdl->types, newType);
1438 create_encoder(
sdl, cur_type, ns->children->content,
name->children->content);
1444 trav = compType->children;
1451 schema_simpleContent(
sdl, tns, trav, cur_type);
1454 schema_complexContent(
sdl, tns, trav, cur_type);
1458 schema_group(
sdl, tns, trav, cur_type,
NULL);
1461 schema_all(
sdl, tns, trav, cur_type,
NULL);
1464 schema_choice(
sdl, tns, trav, cur_type,
NULL);
1467 schema_sequence(
sdl, tns, trav, cur_type,
NULL);
1470 while (trav !=
NULL) {
1472 schema_attribute(
sdl, tns, trav, cur_type,
NULL);
1474 schema_attributeGroup(
sdl, tns, trav, cur_type,
NULL);
1516 attrs = element->properties;
1542 nsptr = xmlSearchNs(element->doc, element, BAD_CAST(ns));
1543 if (nsptr !=
NULL) {
1544 smart_str_appends(&nscat, (
char*)nsptr->href);
1552 smart_str_appends(&nscat, (
char*)ns->children->content);
1555 smart_str_appendc(&nscat,
':');
1556 smart_str_appends(&nscat,
type);
1558 smart_str_0(&nscat);
1559 if (ns) {
efree(ns);}
1561 smart_str_free(&nscat);
1569 if (cur_type ==
NULL) {
1574 addHash =
sdl->elements;
1575 smart_str_appends(&
key, newType->
namens);
1576 smart_str_appendc(&
key,
':');
1577 smart_str_appends(&
key, newType->
name);
1584 smart_str_appends(&
key, newType->
name);
1588 if (zend_hash_add_ptr(addHash,
key.s, newType) ==
NULL) {
1589 if (cur_type ==
NULL) {
1592 zend_hash_next_index_insert_ptr(addHash, newType);
1595 smart_str_free(&
key);
1597 if (model !=
NULL) {
1606 zend_hash_next_index_insert_ptr(model->
u.
content, newModel);
1614 attrs = element->properties;
1618 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'ref' and 'nillable' attributes");
1620 if (!
stricmp((
char*)
attr->children->content,
"true") ||
1633 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'ref' and 'fixed' attributes");
1641 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'default' and 'fixed' attributes");
1649 if (
strncmp((
char*)
attr->children->content,
"qualified",
sizeof(
"qualified")) == 0) {
1651 }
else if (
strncmp((
char*)
attr->children->content,
"unqualified",
sizeof(
"unqualified")) == 0) {
1660 xmlNodePtr parent = element->parent;
1664 def =
get_attribute(parent->properties,
"elementFormDefault");
1665 if(def ==
NULL ||
strncmp((
char*)def->children->content,
"qualified",
sizeof(
"qualified"))) {
1672 parent = parent->parent;
1674 if (parent ==
NULL) {
1687 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'ref' and 'type' attributes");
1690 nsptr = xmlSearchNs(element->doc, element, BAD_CAST(str_ns));
1691 if (nsptr !=
NULL) {
1692 cur_type->
encode = get_create_encoder(
sdl, cur_type, nsptr->href, BAD_CAST(cptype));
1694 if (str_ns) {
efree(str_ns);}
1697 trav = element->children;
1705 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'ref' attribute and subtype");
1707 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'type' attribute and subtype");
1709 schema_simpleType(
sdl, tns, trav, cur_type);
1713 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'ref' attribute and subtype");
1715 soap_error0(
E_ERROR,
"Parsing Schema: element has both 'type' attribute and subtype");
1717 schema_complexType(
sdl, tns, trav, cur_type);
1721 while (trav !=
NULL) {
1769 const char *attr_name;
1774 nsptr = xmlSearchNs(attrType->doc, attrType, BAD_CAST(ns));
1775 if (nsptr !=
NULL) {
1776 smart_str_appends(&
key, (
char*)nsptr->href);
1779 xmlAttrPtr ns =
get_attribute(attrType->properties,
"targetNamespace");
1784 smart_str_appends(&
key, (
char*)ns->children->content);
1787 smart_str_appendc(&
key,
':');
1788 smart_str_appends(&
key, attr_name);
1791 if (ns) {
efree(ns);}
1795 ns =
get_attribute(attrType->properties,
"targetNamespace");
1800 smart_str_appends(&
key, (
char*)ns->children->content);
1801 smart_str_appendc(&
key,
':');
1804 smart_str_appends(&
key, (
char*)
name->children->content);
1808 if (cur_type ==
NULL) {
1818 if (zend_hash_add_ptr(addHash,
key.s, newAttr) ==
NULL) {
1821 smart_str_free(&
key);
1823 soap_error0(
E_ERROR,
"Parsing Schema: attribute has no 'name' nor 'ref' attributes");
1835 soap_error0(
E_ERROR,
"Parsing Schema: attribute has both 'ref' and 'type' attributes");
1838 nsptr = xmlSearchNs(attrType->doc, attrType, BAD_CAST(str_ns));
1839 if (nsptr !=
NULL) {
1840 newAttr->
encode = get_create_encoder(
sdl, cur_type, nsptr->href, BAD_CAST(cptype));
1842 if (str_ns) {
efree(str_ns);}
1845 attr = attrType->properties;
1852 if (
strncmp((
char*)
attr->children->content,
"qualified",
sizeof(
"qualified")) == 0) {
1854 }
else if (
strncmp((
char*)
attr->children->content,
"unqualified",
sizeof(
"unqualified")) == 0) {
1868 if (
strncmp((
char*)
attr->children->content,
"prohibited",
sizeof(
"prohibited")) == 0) {
1870 }
else if (
strncmp((
char*)
attr->children->content,
"required",
sizeof(
"required")) == 0) {
1872 }
else if (
strncmp((
char*)
attr->children->content,
"optional",
sizeof(
"optional")) == 0) {
1890 nsptr = xmlSearchNs(
attr->doc,
attr->parent, BAD_CAST(ns));
1897 if (ns) {
efree(ns);}
1904 smart_str_appends(&key2, (
char*)nsPtr->href);
1905 smart_str_appendc(&key2,
':');
1906 smart_str_appends(&key2, (
char*)
attr->name);
1909 smart_str_free(&key2);
1915 xmlNodePtr parent = attrType->parent;
1919 def =
get_attribute(parent->properties,
"attributeFormDefault");
1920 if(def ==
NULL ||
strncmp((
char*)def->children->content,
"qualified",
sizeof(
"qualified"))) {
1927 parent = parent->parent;
1929 if (parent ==
NULL) {
1933 trav = attrType->children;
1944 soap_error0(
E_ERROR,
"Parsing Schema: attribute has both 'ref' attribute and subtype");
1946 soap_error0(
E_ERROR,
"Parsing Schema: attribute has both 'type' attribute and subtype");
1952 char *
res = zend_print_long_to_buf(
buf +
sizeof(
buf) - 1, zend_hash_num_elements(
sdl->types));
1955 memcpy(str,
"anonymous",
sizeof(
"anonymous")-1);
1957 dummy_type->
name = str;
1959 dummy_type->
namens =
estrdup((
char*)tns->children->content);
1960 schema_simpleType(
sdl, tns, trav, dummy_type);
1984 if (cur_type ==
NULL) {
1989 ns =
get_attribute(attrGroup->properties,
"targetNamespace");
1998 smart_str_appends(&
key, newType->
namens);
1999 smart_str_appendc(&
key,
':');
2000 smart_str_appends(&
key, newType->
name);
2007 smart_str_free(&
key);
2010 const char *group_name;
2023 nsptr = xmlSearchNs(attrGroup->doc, attrGroup, BAD_CAST(ns));
2024 if (nsptr !=
NULL) {
2025 smart_str_appends(&
key, (
char*)nsptr->href);
2027 smart_str_appendc(&
key,
':');
2028 smart_str_appends(&
key, group_name);
2031 if (ns) {
efree(ns);}
2032 smart_str_free(&
key);
2034 zend_hash_next_index_insert_ptr(cur_type->
attributes, newAttr);
2038 soap_error0(
E_ERROR,
"Parsing Schema: attributeGroup has no 'name' nor 'ref' attributes");
2041 trav = attrGroup->children;
2046 while (trav !=
NULL) {
2049 soap_error0(
E_ERROR,
"Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
2051 schema_attribute(
sdl, tns, trav, cur_type,
NULL);
2054 soap_error0(
E_ERROR,
"Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
2056 schema_attributeGroup(
sdl, tns, trav, cur_type,
NULL);
2059 soap_error0(
E_ERROR,
"Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
2065 soap_error1(
E_ERROR,
"Parsing Schema: unexpected <%s> in attributeGroup", trav->name);
2070 soap_error1(
E_ERROR,
"Parsing Schema: unexpected <%s> in attributeGroup", trav->name);
2075static void copy_extra_attribute(
zval *
zv)
2085 if (new_attr->
val) {
2090static void* schema_find_by_ref(
HashTable *
ht,
char *ref)
2094 if ((tmp = zend_hash_str_find_ptr(
ht, ref,
strlen(ref))) !=
NULL) {
2099 if ((tmp = zend_hash_str_find_ptr(
ht, ref,
strlen(ref))) !=
NULL) {
2115 schema_attribute_fixup(ctx, tmp);
2165 zend_hash_internal_pointer_reset(tmp->
attributes);
2171 schema_attribute_fixup(ctx, tmp_attr);
2187 zend_hash_add_ptr(
ht, _key, newAttr);
2193 schema_attributegroup_fixup(ctx, tmp_attr,
ht);
2208 switch (model->
kind) {
2213 schema_type_fixup(ctx, tmp);
2242 schema_content_model_fixup(ctx, tmp);
2281 if (
type->elements) {
2283 schema_type_fixup(ctx, tmp);
2287 schema_content_model_fixup(ctx,
type->model);
2289 if (
type->attributes) {
2293 while ((
attr = zend_hash_get_current_data_ptr_ex(
type->attributes, &
pos)) !=
NULL) {
2298 schema_attribute_fixup(ctx,
attr);
2302 schema_attributegroup_fixup(ctx,
attr,
type->attributes);
2318 schema_attribute_fixup(ctx,
attr);
2323 schema_type_fixup(ctx,
type);
2326 if (
sdl->elements) {
2328 schema_type_fixup(ctx,
type);
2333 schema_type_fixup(ctx,
type);
2338 schema_type_fixup(ctx,
type);
2354 switch (tmp->
kind) {
2375 switch (tmp->
kind) {
2396 delete_model_persistent_int(
Z_PTR_P(
zv));
2415 if (
type->elements) {
2419 if (
type->attributes) {
2428 if (
type->restrictions) {
2440 if (
type->restrictions->enumeration) {
2464 if (
type->elements) {
2466 free(
type->elements);
2468 if (
type->attributes) {
2470 free(
type->attributes);
2473 delete_model_persistent_int(
type->model);
2475 if (
type->restrictions) {
2487 if (
type->restrictions->enumeration) {
2489 free(
type->restrictions->enumeration);
2491 free(
type->restrictions);
2541 if (
attr->extraAttributes) {
2567 if (
attr->extraAttributes) {
2569 free(
attr->extraAttributes);
file_private const char ext[]
copy(string $from, string $to, $context=null)
strrchr(string $haystack, string $needle, bool $before_needle=false)
strchr(string $haystack, string $needle, bool $before_needle=false)
memset(ptr, 0, type->size)
zend_ffi_ctype_name_buf buf
encodePtr get_conversion(int encode)
void whiteSpace_collapse(xmlChar *str)
void delete_encoder(zval *zv)
xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNodePtr parent)
zval * sdl_guess_convert_zval(zval *ret, encodeTypePtr enc, xmlNodePtr data)
unsigned const char * end
unsigned const char * pos
unsigned char key[REFLECTION_KEY_LEN]
void schema_pass2(sdlCtx *ctx)
void delete_type(zval *zv)
void delete_restriction_var_char(zval *zv)
void delete_attribute(zval *zv)
void delete_model(zval *zv)
void delete_restriction_var_char_int(sdlRestrictionCharPtr ptr)
void delete_restriction_var_int(sdlRestrictionIntPtr ptr)
void schema_min_max(xmlNodePtr node, sdlContentModelPtr model)
void delete_model_persistent(zval *zv)
void delete_restriction_var_char_persistent(zval *zv)
void delete_restriction_var_char_persistent_int(sdlRestrictionCharPtr ptr)
void delete_extra_attribute(zval *zv)
void delete_extra_attribute_persistent(zval *zv)
void delete_restriction_var_int_persistent(sdlRestrictionIntPtr ptr)
int load_schema(sdlCtx *ctx, xmlNodePtr schema)
xmlChar * schema_location_construct_uri(const xmlAttr *attribute)
void delete_type_persistent(zval *zv)
void delete_attribute_persistent(zval *zv)
void sdl_set_uri_credentials(sdlCtx *ctx, char *uri)
void sdl_restore_uri_credentials(sdlCtx *ctx)
encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
struct _sdlContentModel * sdlContentModelPtr
struct _sdlContentModel sdlContentModel
struct _sdlExtraAttribute sdlExtraAttribute
@ XSD_TYPEKIND_RESTRICTION
struct _sdlExtraAttribute * sdlExtraAttributePtr
struct _sdlRestrictionChar * sdlRestrictionCharPtr
struct _encode * encodePtr
struct _sdlRestrictionChar sdlRestrictionChar
#define soap_error2(severity, format, param1, param2)
#define soap_error1(severity, format, param1)
struct _sdlRestrictions sdlRestrictions
struct _sdlRestrictionInt * sdlRestrictionIntPtr
struct _sdlRestrictionInt sdlRestrictionInt
struct _sdlType * sdlTypePtr
struct _sdlAttribute sdlAttribute
#define soap_error0(severity, format)
struct _sdlAttribute * sdlAttributePtr
#define soap_error3(severity, format, param1, param2, param3)
int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
void parse_namespace(const xmlChar *inval, const char **value, char **namespace)
xmlNsPtr attr_find_ns(xmlAttrPtr node)
int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns)
xmlDocPtr soap_xmlParseFile(const char *filename)
#define node_is_equal(node, name)
#define get_attribute(node, name)
#define get_node(node, name)
zend_string * clark_notation
xmlNodePtr(* to_xml)(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
zval *(* to_zval)(zval *ret, encodeTypePtr type, xmlNodePtr data)
HashTable * extraAttributes
union _sdlContentModel::@136103057302222375117000326337202052042061025370 u
sdlRestrictionIntPtr minInclusive
sdlRestrictionIntPtr length
sdlRestrictionIntPtr maxExclusive
sdlRestrictionCharPtr pattern
sdlRestrictionIntPtr minExclusive
sdlRestrictionIntPtr minLength
sdlRestrictionIntPtr maxLength
sdlRestrictionCharPtr whiteSpace
sdlRestrictionIntPtr maxInclusive
sdlRestrictionIntPtr totalDigits
sdlRestrictionIntPtr fractionDigits
sdlRestrictionsPtr restrictions
HashTable * attributeGroups
ZEND_API zend_string * zend_strpprintf(size_t max_len, const char *format,...)
#define estrndup(s, length)
strncmp(string $string1, string $string2, int $length)
strcmp(string $string1, string $string2)
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, const HashPosition *pos)
ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h)
ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor)
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
#define HASH_KEY_IS_STRING
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
#define ZEND_HASH_FOREACH_PTR(ht, _ptr)
#define zend_hash_get_current_data_ptr(ht)
#define ZEND_HASH_FOREACH_END()
#define MAX_LENGTH_OF_LONG
struct _zend_string zend_string
struct _zend_array HashTable
ZEND_RESULT_CODE zend_result