I have also struggled to find some proper documentation for the XML filter in the WFS reader.
For those interested, on the forum there are quite some related questions on this topic, e.g.:
Furthermore some more info on the topic of XML filters within WFS GetFeature requests, including some elegant examples can be found at:
From this search on the topic it seems like there are many ways to set up (a bounding box) XML filter for use within the WFS reader. E.g. The fourth link of the knowledge center hints towards the following XML filter to specify a bounding box:
<Filter>
<Within>
<PropertyName>geometry</PropertyName>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>89800,455000 99200,455000 99200,469000 89800,469000 89800,455000</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Within>
</Filter>
On https://mapserver.org/ogc/filter_encoding.html the following example is given to specify a bounding box in an XML filter:
<Filter>
<BBOX>
<PropertyName>Name>NAME</PropertyName>
<Box%20srsName='EPSG:42304'>
<coordinates>135.2239,34.4879 135.8578,34.8471</coordinates>
</Box>
</BBOX>
</Filter>
Finally the OGC Filter Encoding 2.0 specificaton also provide some nice examples of XML filter examples (starting from page 64 of that document, c.q. page 70 of the PDF). Example 4 of this document describes the following XML filter to specify a bounding box (where I omitted the namespace declarations):
<Filter>
<BBOX>
<ValueReference>Geometry</ValueReference>
<Envelope srsName="urn:ogc:def:crs:EPSG::4326">
<lowerCorner>13.0983 31.5899</lowerCorner>
<upperCorner>35.5472 42.8143</upperCorner>
</Envelope>
</BBOX>
</Filter>
Extending from the BBOX examples, here are some initial observations from me on XML filters within the WFS reader:
- It seems that a 'namespace declaration' is not always required for the 'nodes' within the XML filter expression of FME. I'm not sure if this is never needed.
- Quite many of the examples on the forum for XML filters focus on 'attribute queries' that use the XML node 'PropertyName'. The first example from the OGC Filter Encoding 2.0 specificaton seems to use the XML node 'ValueReference' instead. In one of my workspaces I came across the situation that using the XML node 'PropertyName' didn't query out the required data, while using the ~similar (?) XML node 'ValueReference' did query out the desired data.
The example to the latter bullit was as follows. The following XML filter failed to query out the data:
<Filter>
<PropertyIsEqualTo>
<PropertyName>code</PropertyName>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
While the following XML filter did query out the data.
<Filter>
<PropertyIsEqualTo>
<ValueReference>code</ValueReference>
<Literal>0505</Literal>
</PropertyIsEqualTo>
</Filter>
Please note that the first type of query did work for me in most other cases (I think the problem arises from the number starting with a 0). I'm also not sure if the XML node 'ValueReference' can be used for all WFS versions (i.e. it might be only valid for WFS version 2.0)