| 99 | */ |
| 100 | |
| 101 | char *msWFSGetOutputFormatList(mapObj *map, layerObj *layer, |
| 102 | const char *version ) |
| 103 | { |
| 104 | int i, got_map_list = 0; |
| 105 | static const int out_list_size = 20000; |
| 106 | char *out_list = (char*) msSmallCalloc(1,out_list_size); |
| 107 | |
| 108 | if( strncasecmp(version,"1.0",3) != 0 ) |
| 109 | strcpy(out_list,"text/xml; subtype=gml/3.1.1"); |
| 110 | else |
| 111 | strcpy(out_list,"GML2"); |
| 112 | |
| 113 | for( i = 0; i < map->numlayers; i++ ) |
| 114 | { |
| 115 | const char *format_list; |
| 116 | layerObj *lp; |
| 117 | int j, n; |
| 118 | char **tokens; |
| 119 | |
| 120 | lp = GET_LAYER(map, i); |
| 121 | if( layer != NULL && layer != lp ) |
| 122 | continue; |
| 123 | |
| 124 | format_list = msOWSLookupMetadata(&(lp->metadata), |
| 125 | "F","getfeature_formatlist"); |
| 126 | |
| 127 | if( format_list == NULL && !got_map_list ) |
| 128 | { |
| 129 | format_list = msOWSLookupMetadata(&(map->web.metadata), |
| 130 | "F","getfeature_formatlist"); |
| 131 | got_map_list = 1; |
| 132 | } |
| 133 | |
| 134 | if( format_list == NULL ) |
| 135 | continue; |
| 136 | |
| 137 | n = 0; |
| 138 | tokens = msStringSplit(format_list, ',', &n); |
| 139 | |
| 140 | for( j = 0; j < n; j++ ) |
| 141 | { |
| 142 | int iformat; |
| 143 | const char *fname, *hit; |
| 144 | outputFormatObj *format_obj; |
| 145 | |
| 146 | msStringTrim( tokens[j] ); |
| 147 | iformat = msGetOutputFormatIndex(map,tokens[j]); |
| 148 | if( iformat < 0 ) |
| 149 | continue; |
| 150 | |
| 151 | format_obj = map->outputformatlist[iformat]; |
| 152 | |
| 153 | fname = format_obj->name; |
| 154 | if( strncasecmp(version,"1.0",3) != 0 |
| 155 | && format_obj->mimetype != NULL ) |
| 156 | fname = format_obj->mimetype; |
| 157 | |
| 158 | hit = strstr(out_list,fname); |
no test coverage detected