44 buffer *character_maximum_length;
46 list *check_constraints;
56 fprintf(o->
output,
"<xs:complexType name='");
58 fprintf(o->
output,
"Type'>\n");
59 fprintf(o->
output,
" <xs:complexContent>\n");
60 fprintf(o->
output,
" <xs:extension base='gml:AbstractFeatureType'>\n");
61 fprintf(o->
output,
" <xs:sequence>\n");
69 for (an = table->
first ; an ; an = an->
next) {
75 if ( !strcmp(
"name", an->
key->
buf)
76 || !strcmp(
"description", an->
key->
buf)
77 || !strcmp(
"boundedBy", an->
key->
buf)) {
81 fprintf(o->
output,
" <xs:element ref='gml:%s'/>\n", an->
key->
buf);
97 if(!strcmp(xsd_type,
"string")) {
101 if(strcmp(constraint_name->
buf,
"")) {
102 fprintf(o->
output,
" <xs:element name ='%s' ", an->
key->
buf);
103 if (mandatory_prop &&
in_list(mandatory_prop, an->
key))
104 fprintf(o->
output,
"nillable='false' minOccurs='1' ");
106 fprintf(o->
output,
"nillable='true' minOccurs='0' ");
107 fprintf(o->
output,
"maxOccurs='1'>\n");
109 fprintf(o->
output,
"<xs:simpleType><xs:restriction base='string'>");
111 for (ln = check_constraints->
first ; ln ; ln = ln->
next) {
112 fprintf(o->
output,
"<xs:enumeration value='%s'/>", ln->
value->
buf);
114 fprintf(o->
output,
"</xs:restriction></xs:simpleType></xs:element>");
117 if(strcmp(character_maximum_length->
buf,
"")) {
118 fprintf(o->
output,
" <xs:element name ='%s' ", an->
key->
buf);
119 if (mandatory_prop &&
in_list(mandatory_prop, an->
key))
120 fprintf(o->
output,
"nillable='false' minOccurs='1' ");
122 fprintf(o->
output,
"nillable='true' minOccurs='0' ");
123 fprintf(o->
output,
"maxOccurs='1'>\n");
124 fprintf(o->
output,
"<xs:simpleType><xs:restriction base='string'>");
125 fprintf(o->
output,
"<xs:maxLength value='%s'/>", character_maximum_length->
buf);
126 fprintf(o->
output,
"</xs:restriction></xs:simpleType></xs:element>");
128 fprintf(o->
output,
" <xs:element name ='%s' type='%s' ",
131 if (mandatory_prop &&
in_list(mandatory_prop, an->
key))
132 fprintf(o->
output,
"nillable='false' minOccurs='1' ");
134 fprintf(o->
output,
"nillable='true' minOccurs='0' ");
135 fprintf(o->
output,
"maxOccurs='1'/>\n");
141 fprintf(o->
output,
" <xs:element name ='%s' type='%s' ",
144 if (mandatory_prop &&
in_list(mandatory_prop, an->
key))
145 fprintf(o->
output,
"nillable='false' minOccurs='1' ");
147 fprintf(o->
output,
"nillable='true' minOccurs='0' ");
149 fprintf(o->
output,
"maxOccurs='1'/>\n");
153 fprintf(o->
output,
" </xs:sequence>\n");
154 fprintf(o->
output,
" </xs:extension>\n");
155 fprintf(o->
output,
" </xs:complexContent>\n");
156 fprintf(o->
output,
"</xs:complexType>\n");
169 list *ns_prefix, *typ, *layer_name;
177 if (!ns_prefix || !ns_prefix->
first) {
180 "Not a single layer is available. Check config file",
"describe");
185 fprintf(o->
output,
"Content-Type: text/xml; subtype=gml/2.1.2;\n\n");
187 fprintf(o->
output,
"Content-Type: text/xml; subtype=gml/3.1.1;\n\n");
197 fprintf(o->
output,
"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'");
198 fprintf(o->
output,
" xmlns='http://www.w3.org/2001/XMLSchema'");
199 fprintf(o->
output,
" elementFormDefault='qualified'> ");
201 for (elemt = ns_prefix->
first ; elemt ; elemt = elemt->
next) {
206 if(
namespace == NULL ) {
207 fprintf(stderr,
"Cannot find namespace URI for prefix %s\n",
212 fprintf(o->output,
"<xs:import namespace='%s' ", namespace->buf);
213 fprintf(o->output,
"schemaLocation='%s?service=WFS&version=",
214 o->online_resource->buf);
216 if (wfs_version == 100)
217 fprintf(o->output,
"1.0.0&request=DescribeFeatureType&typename=");
219 fprintf(o->output,
"1.1.0&request=DescribeFeatureType&typename=");
224 for (ln = typ->
first ; ln ; ln = ln->
next) {
225 fprintf(o->output,
"%s", ln->
value->
buf);
227 if (ln->
next) fprintf(o->output,
",");
231 fprintf(o->output,
"' />\n\n");
234 fprintf(o->
output,
"</xs:schema>\n");
239 fprintf(o->output,
"<xs:schema targetNamespace='%s' ", namespace->buf);
240 fprintf(o->output,
"xmlns:%s='%s' ", ns_prefix->first->value->buf, namespace->buf);
241 fprintf(o->output,
"xmlns:ogc='http://www.opengis.net/ogc' ");
242 fprintf(o->output,
"xmlns:xs='http://www.w3.org/2001/XMLSchema' ");
243 fprintf(o->output,
"xmlns='http://www.w3.org/2001/XMLSchema' ");
244 fprintf(o->output,
"xmlns:gml='http://www.opengis.net/gml' ");
245 fprintf(o->output,
"elementFormDefault='qualified' ");
247 if (wfs_version == 100) fprintf(o->output,
"version='1.0'>\n");
248 else fprintf(o->output,
"version='1.1'>\n");
250 fprintf(o->output,
"<xs:import namespace='http://www.opengis.net/gml'");
252 if (wfs_version == 100)
253 fprintf(o->output,
" schemaLocation='http://schemas.opengis.net/gml/2.1.2/feature.xsd'/>\n");
255 fprintf(o->output,
" schemaLocation='http://schemas.opengis.net/gml/3.1.1/base/gml.xsd'/>\n");
258 for (elemt = wr->typename->first ; elemt ; elemt = elemt->
next) {
259 fprintf(o->output,
"<xs:element name='");
261 fprintf(o->output,
"' type='");
263 fprintf(o->output,
"Type' substitutionGroup='gml:_Feature' />\n");
267 fprintf(o->output,
"</xs:schema>");
282 list *ns_prefix, *
typename, *layers, *layers_name_prefix;
283 buffer *
namespace, *schema;
287 assert(o && version);
294 for (elemt = layers->
first; elemt ; elemt = elemt->
next) {
298 buffer_add_str(schema,
"<?xml version='1.0' encoding='utf-8'?>\n");
302 buffer_add_str(schema,
"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'");
303 buffer_add_str(schema,
" xmlns='http://www.w3.org/2001/XMLSchema' elementFormDefault='qualified'>\n");
304 buffer_add_str(schema,
"<xs:import namespace='http://www.opengis.net/wfs' schemaLocation='");
312 for (elemt = ns_prefix->
first ; elemt ; elemt = elemt->
next) {
317 if(
namespace == NULL ) {
318 fprintf(stderr,
"Cannot find namespace URI for prefix %s\n",
327 buffer_add_str(schema,
"?service=WFS&request=DescribeFeatureType");
329 if (elemt->next || elemt != ns_prefix->
first) {
333 for (t = typename->first ; t ; t = t->
next) {
340 if (wfs_version == 100)
buffer_add_str(schema,
"&version=1.0.0");
list * ows_psql_not_null_properties(ows *o, buffer *layer_name)
void buffer_add(buffer *buf, char c)
int ows_version_get(ows_version *v)
void list_add_by_copy(list *l, buffer *value)
buffer * ows_psql_column_constraint_name(ows *o, buffer *column_name, buffer *table_name)
void buffer_copy(buffer *dest, const buffer *src)
buffer * ows_psql_column_character_maximum_length(ows *o, buffer *column_name, buffer *table_name)
bool buffer_cmp(const buffer *buf, const char *str)
bool in_list(const list *l, const buffer *value)
void buffer_add_str(buffer *buf, const char *str)
void buffer_flush(buffer *buf, FILE *output)
buffer * ows_psql_id_column(ows *o, buffer *layer_name)
void ows_error(ows *o, enum ows_error_code code, char *message, char *locator)
buffer * ows_layer_ns_prefix_to_ns_uri(ows_layer_list *ll, buffer *ns_prefix)
list * ows_psql_column_check_constraint(ows *o, buffer *constraint_name)
list * ows_layer_list_ns_prefix(ows_layer_list *ll, list *layer_name_prefix)
array * ows_psql_describe_table(ows *o, buffer *layer_name)
void buffer_free(buffer *buf)
list * ows_layer_list_having_storage(const ows_layer_list *ll)
buffer * ows_layer_uri_to_prefix(ows_layer_list *ll, buffer *layer_name)
char * ows_psql_to_xsd(buffer *type, enum wfs_format format)
buffer * ows_layer_no_uri(ows_layer_list *ll, buffer *layer_name)
ows_layer * ows_layer_get(const ows_layer_list *ll, const buffer *name)
list * ows_layer_list_prefix_to_uri(ows_layer_list *ll, list *layer_name_prefix)
list * ows_layer_list_by_ns_prefix(ows_layer_list *ll, list *layer_name_prefix, buffer *ns_prefix)
buffer * ows_psql_table_name(ows *o, buffer *layer_name)
buffer * ows_layer_prefix_to_uri(ows_layer_list *ll, buffer *layer_name_prefix)
struct List_node list_node
struct Ows_version ows_version
struct Array_node array_node
char * buf
size to next realloc
union Ows_request::@061103224255043274127022210112340325046267027263 request
buffer * wfs_generate_schema(ows *o, ows_version *version)
void wfs_describe_feature_type(ows *o, wfs_request *wr)
static void wfs_complex_type(ows *o, wfs_request *wr, buffer *layer_name)