/ msWFSGetCapabilities11 */ / Return the capabilities document for wfs 1.1.0 */ /
| 253 | /* Return the capabilities document for wfs 1.1.0 */ |
| 254 | /************************************************************************/ |
| 255 | int msWFSGetCapabilities11(mapObj *map, wfsParamsObj *params, |
| 256 | cgiRequestObj *req, owsRequestObj *ows_request) |
| 257 | { |
| 258 | xmlDocPtr psDoc = NULL; /* document pointer */ |
| 259 | xmlNodePtr psRootNode, psMainNode, psNode, psFtNode; |
| 260 | xmlNodePtr psTmpNode; |
| 261 | const char *updatesequence=NULL; |
| 262 | xmlNsPtr psNsOws, psNsXLink, psNsOgc; |
| 263 | char *schemalocation = NULL; |
| 264 | char *xsi_schemaLocation = NULL; |
| 265 | |
| 266 | char *script_url=NULL, *script_url_encoded=NULL, *formats_list; |
| 267 | const char *value = NULL; |
| 268 | const char *encoding; |
| 269 | |
| 270 | xmlChar *buffer = NULL; |
| 271 | int size = 0, i; |
| 272 | msIOContext *context = NULL; |
| 273 | |
| 274 | int ows_version = OWS_1_0_0; |
| 275 | |
| 276 | /* -------------------------------------------------------------------- */ |
| 277 | /* Handle updatesequence */ |
| 278 | /* -------------------------------------------------------------------- */ |
| 279 | |
| 280 | updatesequence = msOWSLookupMetadata(&(map->web.metadata), "FO", "updatesequence"); |
| 281 | |
| 282 | encoding = msOWSLookupMetadata(&(map->web.metadata), "FO", "encoding"); |
| 283 | |
| 284 | if (params->pszUpdateSequence != NULL) { |
| 285 | i = msOWSNegotiateUpdateSequence(params->pszUpdateSequence, updatesequence); |
| 286 | if (i == 0) { /* current */ |
| 287 | msSetError(MS_WFSERR, "UPDATESEQUENCE parameter (%s) is equal to server (%s)", "msWFSGetCapabilities11()", params->pszUpdateSequence, updatesequence); |
| 288 | return msWFSException11(map, "updatesequence", "CurrentUpdateSequence", params->pszVersion); |
| 289 | } |
| 290 | if (i > 0) { /* invalid */ |
| 291 | msSetError(MS_WFSERR, "UPDATESEQUENCE parameter (%s) is higher than server (%s)", "msWFSGetCapabilities11()", params->pszUpdateSequence, updatesequence); |
| 292 | return msWFSException11(map, "updatesequence", "InvalidUpdateSequence", params->pszVersion); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | /* -------------------------------------------------------------------- */ |
| 297 | /* Create document. */ |
| 298 | /* -------------------------------------------------------------------- */ |
| 299 | psDoc = xmlNewDoc(BAD_CAST "1.0"); |
| 300 | |
| 301 | psRootNode = xmlNewNode(NULL, BAD_CAST "WFS_Capabilities"); |
| 302 | |
| 303 | xmlDocSetRootElement(psDoc, psRootNode); |
| 304 | |
| 305 | /* -------------------------------------------------------------------- */ |
| 306 | /* Name spaces */ |
| 307 | /* -------------------------------------------------------------------- */ |
| 308 | /*default name space*/ |
| 309 | xmlNewProp(psRootNode, BAD_CAST "xmlns", BAD_CAST "http://www.opengis.net/wfs"); |
| 310 | |
| 311 | xmlSetNs(psRootNode, xmlNewNs(psRootNode, BAD_CAST "http://www.opengis.net/gml", BAD_CAST "gml")); |
| 312 | xmlSetNs(psRootNode, xmlNewNs(psRootNode, BAD_CAST "http://www.opengis.net/wfs", BAD_CAST "wfs")); |
no test coverage detected