Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1116 closed defect (fixed)

GetRecords hardcoded prefixes in TypeNames check

Reported by: heikki Owned by: heikki
Priority: major Milestone: v2.8.0
Component: Catalog server Version:
Keywords: csw getrecords namespace prefix typenames Cc:

Description

The check for legal TypeNames in GetRecords, only accepts "csw:Record" or "gmd:MD_Metadata". If an input document uses different prefixes for those namespaces, it's rejected.

This fix checks what the prefixes are for the CSW and the GMD namespace, in the scope of the query element. If not found, default values "csw" and "gmd" are used. The test for legal TypeNames values then uses this prefix for its check.

Computing the namespaces in scope is done using the algorithm in JDOM2 Element, adapted for use with JDOM1.

Change History (3)

comment:1 by heikki, 12 years ago

committed in master f77202f0e45ca19b36dac3b9d90561b029c3f75b

comment:2 by heikki, 12 years ago

Resolution: fixed
Status: newclosed

committed in 2.8.x eda67853e8353ce6838ba85d5f727b03ea6aea7e

comment:3 by fxp, 12 years ago

During testing, this request which was supported is not anymore because it requires the xmlns="http://www.opengis.net/cat/csw/2.0.2" to be xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" for the typeNames to match

<GetRecords xmlns="http://www.opengis.net/cat/csw/2.0.2" service="CSW" startPosition="1" maxRecords="5" version="2.0.2" resultType="results">
    <Query typeNames="csw:Record">
        <ElementSetName>full</ElementSetName>
        <Constraint version="1.1.0">
            <Filter xmlns="http://www.opengis.net/ogc">
              <PropertyIsEqualTo>
                <PropertyName>subject</PropertyName>
                <Literal>mediterranean-sea</Literal>
              </PropertyIsEqualTo>
            </Filter>
        </Constraint>
    </Query>
</GetRecords>

Also testing that case where no namespace is used in prefix is not supported (but not sure if it needs to be).

<GetRecords xmlns="http://www.opengis.net/cat/csw/2.0.2" service="CSW" startPosition="1" maxRecords="5" version="2.0.2" resultType="results">
    <Query typeNames="Record">
        <ElementSetName>full</ElementSetName>
        <Constraint version="1.1.0">
            <Filter xmlns="http://www.opengis.net/ogc">
              <PropertyIsEqualTo>
                <PropertyName>subject</PropertyName>
                <Literal>mediterranean-sea</Literal>
              </PropertyIsEqualTo>
            </Filter>
        </Constraint>
    </Query>
</GetRecords>
Note: See TracTickets for help on using tickets.