Details
Description
This was wrongly raised in Geotools JIRA: http://jira.codehaus.org/browse/GEOT-2678
The response to an app-schema DescribeFeatureType request is schema-invalid:
For example:
http://services.auscope.org/pirsa-earthresource/wfs?request=DescribeFeatureType&typename=er:Commodity
yields
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:er="urn:cgi:xmlns:GGIC:EarthResource:1.1" xmlns:gml="http://www.opengis.net/gml"
elementFormDefault="qualified" targetNamespace="urn:cgi:xmlns:GGIC:EarthResource:1.1">
<xsd:import namespace="http://www.opengis.net/gml"
schemaLocation="http://services.auscope.org:80/pirsa-earthresource/schemas/gml/3.1.1/base/gml.xsd" />
<xsd:import namespace="urn:cgi:xmlns:GGIC:EarthResource:1.1"
schemaLocation="http://www.earthresourceml.org/earthresourceml/1.1/xsd/earthResource.xsd" />
</xsd:schema>
This is schema-invalid because the import namespace is the same as the targetNamespace. Should this be an include?
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#element-import
"1.1 If the namespace [attribute] is present, then its - actual value- must not match the - actual value- of the enclosing <schema>'s targetNamespace [attribute]."
Hi Justin,
Please review my patch when you have time.
Changes in FeatureTypeSchemaBuilder:
1. If there's only 1 namespace in the describeFeatureType request, targetNamespace would be encoded.
If schemaLocation is specified in app-schema mapping file, then it would only encode xsd:include pointing to the schema location.
Gml.xsd wouldn't be imported as previously done, because it was only needed for manually built schema. Not only that it's redundant for this case, it also causes XMLSpy validation error (that the user doesn't think is acceptable) because if the schema location that's included already imports gml.xsd, it would complain that some elements are declared twice.
If there's no schemaLocation, the schema is manually built as original, and gml.xsd is imported.
2. If there are more than 1 namespace in the request (or if no type name is specified, and there are more than 1 namespaces available), target namespace wouldn't be encoded (as original).
If schema locations are specified in app-schema mapping file, it would encode xsd:import point to the schema location.
Otherwise the original describe feature type URL for all the type names would be encoded.
Test cases are updated in FeatureChainingWfsTest testDescribeFeatureType(). All other tests passed.
Thank's!
Rini