MCPcopy Index your code
hub / github.com/MapServer/MapServer / msGMLWriteGroup

Function msGMLWriteGroup

mapgml.c:1074–1125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1072}
1073
1074static void msGMLWriteGroup(FILE *stream, gmlGroupObj *group, shapeObj *shape, gmlItemListObj *itemList, gmlConstantListObj *constantList, const char *namespace, const char *tab)
1075{
1076 int i,j;
1077 int add_namespace = MS_TRUE;
1078 char *itemtab;
1079
1080 gmlItemObj *item=NULL;
1081 gmlConstantObj *constant=NULL;
1082
1083 if(!stream || !group) return;
1084
1085 /* setup the item/constant tab */
1086 itemtab = (char *) msSmallMalloc(sizeof(char)*strlen(tab)+3);
1087
1088 sprintf(itemtab, "%s ", tab);
1089
1090 if(!namespace || strchr(group->name, ':') != NULL) add_namespace = MS_FALSE;
1091
1092 /* start the group */
1093 if(add_namespace == MS_TRUE)
1094 msIO_fprintf(stream, "%s<%s:%s>\n", tab, namespace, group->name);
1095 else
1096 msIO_fprintf(stream, "%s<%s>\n", tab, group->name);
1097
1098 /* now the items/constants in the group */
1099 for(i=0; i<group->numitems; i++) {
1100 for(j=0; j<constantList->numconstants; j++) {
1101 constant = &(constantList->constants[j]);
1102 if(strcasecmp(constant->name, group->items[i]) == 0) {
1103 msGMLWriteConstant(stream, constant, namespace, itemtab);
1104 break;
1105 }
1106 }
1107 if(j != constantList->numconstants) continue; /* found this one */
1108 for(j=0; j<itemList->numitems; j++) {
1109 item = &(itemList->items[j]);
1110 if(strcasecmp(item->name, group->items[i]) == 0) {
1111 /* the number of items matches the number of values exactly */
1112 msGMLWriteItem(stream, item, shape->values[j], namespace, itemtab);
1113 break;
1114 }
1115 }
1116 }
1117
1118 /* end the group */
1119 if(add_namespace == MS_TRUE)
1120 msIO_fprintf(stream, "%s</%s:%s>\n", tab, namespace, group->name);
1121 else
1122 msIO_fprintf(stream, "%s</%s>\n", tab, group->name);
1123
1124 return;
1125}
1126#endif
1127
1128/* Dump GML query results for WMS GetFeatureInfo */

Callers 2

msGMLWriteQueryFunction · 0.85
msGMLWriteWFSQueryFunction · 0.85

Calls 5

msSmallMallocFunction · 0.85
msIO_fprintfFunction · 0.85
strcasecmpFunction · 0.85
msGMLWriteConstantFunction · 0.85
msGMLWriteItemFunction · 0.85

Tested by

no test coverage detected