Hi List,
Just to follow up on my own question. I have found a solution inspired by this ticket https://osgeo-org.atlassian.net/browse/GEOS-5512 and the comment by Lurie Maxim, which suggests to split the QueryExpressionText tag into three separate instances. The final query looks like this: <?xml version="1.0" encoding="UTF-8"?> <wfs:CreateStoredQuery xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:plu="http://inspire.ec.europa.eu/schemas/plu/4.0" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd" service="WFS" version="2.0.0"> <wfs:StoredQueryDefinition id="http://inspire.ec.europa.eu/operation/download/GetSpatialDataSet"> <wfs:Title>Get Spatial Data Set</wfs:Title> <wfs:Abstract>This stored query enables the download of a complete spatial data set.</wfs:Abstract> <wfs:Parameter name="DataSetIdCode" type="xsd:string"/> <wfs:QueryExpressionText returnFeatureTypes="plu:OfficialDocumentation" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression" isPrivate="false"> <wfs:Query typeNames="plu:OfficialDocumentation"> <fes:Filter> <fes:PropertyIsEqualTo> <fes:ValueReference>plu:inspireId/base:Identifier/base:namespace</fes:ValueReference> <fes:Literal>${DataSetIdCode}</fes:Literal> </fes:PropertyIsEqualTo> </fes:Filter> </wfs:Query> </wfs:QueryExpressionText> <wfs:QueryExpressionText returnFeatureTypes="plu:SpatialPlan" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression" isPrivate="false"> <wfs:Query typeNames="plu:SpatialPlan"> <fes:Filter> <fes:PropertyIsEqualTo> <fes:ValueReference>plu:inspireId/base:Identifier/base:namespace</fes:ValueReference> <fes:Literal>${DataSetIdCode}</fes:Literal> </fes:PropertyIsEqualTo> </fes:Filter> </wfs:Query> </wfs:QueryExpressionText> <wfs:QueryExpressionText returnFeatureTypes="plu:ZoningElement" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression" isPrivate="false"> <wfs:Query typeNames="plu:ZoningElement"> <fes:Filter> <fes:PropertyIsEqualTo> <fes:ValueReference>plu:inspireId/base:Identifier/base:namespace</fes:ValueReference> <fes:Literal>${DataSetIdCode}</fes:Literal> </fes:PropertyIsEqualTo> </fes:Filter> </wfs:Query> </wfs:QueryExpressionText> </wfs:StoredQueryDefinition> </wfs:CreateStoredQuery> Regards, Jonas Fra: Jonas Nygaard Pedersen <jo...@sdfe.dk> Sendt: 21. december 2018 14:49 Til: 'geoserver-users@lists.sourceforge.net' <geoserver-users@lists.sourceforge.net> Emne: [Geoserver-users] Stored query with geoserver Hi List, I'm trying to create a stored query for a an INSPIRE wfs (plu). But I can't seem to get it right. Can anyone here see what I'm doing wrong? The stored query (filename: plu_inspire_storedquery.xml) : <?xml version="1.0" encoding="UTF-8"?> <wfs:CreateStoredQuery xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:plu="http://inspire.ec.europa.eu/schemas/plu/4.0" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd<http://www.opengis.net/wfs/2.0%20http:/schemas.opengis.net/wfs/2.0/wfs.xsd>" service="WFS" version="2.0.0"> <wfs:StoredQueryDefinition id="http://inspire.ec.europa.eu/operation/download/GetSpatialDataSet"> <wfs:Title>Get Spatial Data Set</wfs:Title> <wfs:Abstract>This stored query enables the download of a complete spatial data set.</wfs:Abstract> <wfs:Parameter name="DataSetIdCode" type="xsd:string"/> <wfs:QueryExpressionText returnFeatureTypes="plu:OfficialDocumentation plu:SpatialPlan plu:ZoningElement" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression" isPrivate="false"> <wfs:Query typeNames="plu:OfficialDocumentation"> <fes:Filter> <fes:PropertyIsEqualTo> <fes:ValueReference>plu:inspireId/base:Identifier/base:namespace</fes:ValueReference> <fes:Literal>${DataSetIdCode}</fes:Literal> </fes:PropertyIsEqualTo> </fes:Filter> </wfs:Query> <wfs:Query typeNames="plu:SpatialPlan"> <fes:Filter> <fes:PropertyIsEqualTo> <fes:ValueReference>plu:inspireId/base:Identifier/base:namespace</fes:ValueReference> <fes:Literal>${DataSetIdCode}</fes:Literal> </fes:PropertyIsEqualTo> </fes:Filter> </wfs:Query> <wfs:Query typeNames="plu:ZoningElement"> <fes:Filter> <fes:PropertyIsEqualTo> <fes:ValueReference>plu:inspireId/base:Identifier/base:namespace</fes:ValueReference> <fes:Literal>${DataSetIdCode}</fes:Literal> </fes:PropertyIsEqualTo> </fes:Filter> </wfs:Query> </wfs:QueryExpressionText> </wfs:StoredQueryDefinition> </wfs:CreateStoredQuery> The curl command to create the query: curl -vvv --header "Content-Type: text/xml" --data @plu_inspire_storedquery.xml --output curl_createstoredquery_log.txt http://localhost:8061/plu/wfs? The output of the logfile: <?xml version="1.0" encoding="UTF-8"?><ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://localhost.dk:8061/schemas/ows/1.1.0 /owsAll.xsd"> <ows:Exception exceptionCode="OperationProcessingFailed" locator="CreateStoredQuery"> <ows:ExceptionText>Error validating stored query org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 647; The markup in the document following the root element must be well-formed. The markup in the document following the root element must be well-formed.</ows:ExceptionText> </ows:Exception> </ows:ExceptionReport> I have tried to validate the xml in notepad ++ (using the XML Tools plugin) and it validates fine. Regards and happy holidays:) Jonas Jonas Nygaard Pedersen │ IT-udvikler │ DAD - SDFE │ Tel. 7254 5510 │ jo...@sdfe.dk<mailto:jo...@sdfe.dk>
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users