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

Function msWFSException11

mapwfs11.c:44–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42/************************************************************************/
43
44int msWFSException11(mapObj *map, const char *locator,
45 const char *exceptionCode, const char *version)
46{
47 int size = 0;
48 char *errorString = NULL;
49 char *errorMessage = NULL;
50 char *schemasLocation = NULL;
51 const char *encoding;
52
53 xmlDocPtr psDoc = NULL;
54 xmlNodePtr psRootNode = NULL;
55 xmlNsPtr psNsOws = NULL;
56 xmlChar *buffer = NULL;
57
58 if (version == NULL)
59 version = "1.1.0";
60
61 psNsOws = xmlNewNs(NULL, BAD_CAST "http://www.opengis.net/ows", BAD_CAST "ows");
62
63 encoding = msOWSLookupMetadata(&(map->web.metadata), "FO", "encoding");
64
65 errorString = msGetErrorString("\n");
66 errorMessage = msEncodeHTMLEntities(errorString);
67 schemasLocation = msEncodeHTMLEntities(msOWSGetSchemasLocation(map));
68
69 psDoc = xmlNewDoc(BAD_CAST "1.0");
70
71 psRootNode = msOWSCommonExceptionReport(psNsOws, OWS_1_0_0, schemasLocation, version, msOWSGetLanguage(map, "exception"), exceptionCode, locator, errorMessage);
72
73 xmlDocSetRootElement(psDoc, psRootNode);
74
75 xmlNewNs(psRootNode, BAD_CAST "http://www.opengis.net/ows", BAD_CAST "ows");
76
77 if (encoding)
78 msIO_printf("Content-type: text/xml; charset=%s%c%c", encoding,10,10);
79 else
80 msIO_printf("Content-type: text/xml%c%c",10,10);
81
82 xmlDocDumpFormatMemoryEnc(psDoc, &buffer, &size, (encoding ? encoding : "ISO-8859-1"), 1);
83
84 msIO_printf("%s", buffer);
85
86 /*free buffer and the document */
87 free(errorString);
88 free(errorMessage);
89 free(schemasLocation);
90 xmlFree(buffer);
91 xmlFreeDoc(psDoc);
92 xmlFreeNs(psNsOws);
93
94 /* clear error since we have already reported it */
95 msResetErrorList();
96
97 return MS_FAILURE;
98}
99
100
101/************************************************************************/

Callers 3

msWFSGetCapabilities11Function · 0.85
msWFSExceptionFunction · 0.85
msWFSDispatchFunction · 0.85

Calls 9

msOWSLookupMetadataFunction · 0.85
msGetErrorStringFunction · 0.85
msEncodeHTMLEntitiesFunction · 0.85
msOWSGetSchemasLocationFunction · 0.85
msOWSGetLanguageFunction · 0.85
msIO_printfFunction · 0.85
msResetErrorListFunction · 0.85
msWFSExceptionFunction · 0.85

Tested by

no test coverage detected