** msOWSLookupMetadata() ** ** Attempts to lookup a given metadata name in multiple OWS namespaces. ** ** 'namespaces' is a string with a letter for each namespace to lookup ** in the order they should be looked up. e.g. "MO" to lookup wms_ and ows_ ** If namespaces is NULL then this function just does a regular metadata ** lookup. */
| 400 | ** lookup. |
| 401 | */ |
| 402 | const char *msOWSLookupMetadata(hashTableObj *metadata, |
| 403 | const char *namespaces, const char *name) |
| 404 | { |
| 405 | const char *value = NULL; |
| 406 | |
| 407 | if (namespaces == NULL) |
| 408 | { |
| 409 | value = msLookupHashTable(metadata, (char*)name); |
| 410 | } |
| 411 | else |
| 412 | { |
| 413 | char buf[100] = "ows_"; |
| 414 | |
| 415 | strlcpy(buf+4, name, 96); |
| 416 | |
| 417 | while (value == NULL && *namespaces != '\0') |
| 418 | { |
| 419 | switch (*namespaces) |
| 420 | { |
| 421 | case 'O': /* ows_... */ |
| 422 | buf[0] = 'o'; |
| 423 | buf[1] = 'w'; |
| 424 | buf[2] = 's'; |
| 425 | break; |
| 426 | case 'M': /* wms_... */ |
| 427 | buf[0] = 'w'; |
| 428 | buf[1] = 'm'; |
| 429 | buf[2] = 's'; |
| 430 | break; |
| 431 | case 'F': /* wfs_... */ |
| 432 | buf[0] = 'w'; |
| 433 | buf[1] = 'f'; |
| 434 | buf[2] = 's'; |
| 435 | break; |
| 436 | case 'C': /* wcs_... */ |
| 437 | buf[0] = 'w'; |
| 438 | buf[1] = 'c'; |
| 439 | buf[2] = 's'; |
| 440 | break; |
| 441 | case 'G': /* gml_... */ |
| 442 | buf[0] = 'g'; |
| 443 | buf[1] = 'm'; |
| 444 | buf[2] = 'l'; |
| 445 | break; |
| 446 | case 'S': /* sos_... */ |
| 447 | buf[0] = 's'; |
| 448 | buf[1] = 'o'; |
| 449 | buf[2] = 's'; |
| 450 | break; |
| 451 | default: |
| 452 | /* We should never get here unless an invalid code (typo) is */ |
| 453 | /* present in the code, but since this happened before... */ |
| 454 | msSetError(MS_WMSERR, |
| 455 | "Unsupported metadata namespace code (%c).", |
| 456 | "msOWSLookupMetadata()", *namespaces ); |
| 457 | assert(MS_FALSE); |
| 458 | return NULL; |
| 459 | } |
no test coverage detected