[mapserver-commits] r9792 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Feb 12 16:47:09 EST 2010
Author: assefa
Date: 2010-02-12 16:47:09 -0500 (Fri, 12 Feb 2010)
New Revision: 9792
Modified:
trunk/mapserver/mapogcfilter.c
trunk/mapserver/mapwfs.c
Log:
Strip name spaces used in property names #3308
Modified: trunk/mapserver/mapogcfilter.c
===================================================================
--- trunk/mapserver/mapogcfilter.c 2010-02-12 15:49:26 UTC (rev 9791)
+++ trunk/mapserver/mapogcfilter.c 2010-02-12 21:47:09 UTC (rev 9792)
@@ -3991,6 +3991,36 @@
}
+static void FLTStripNameSpacesFromPropertyName(FilterEncodingNode *psFilterNode)
+{
+ char **tokens=NULL;
+ int n=0;
+
+ if (psFilterNode)
+ {
+ if (psFilterNode->eType == FILTER_NODE_TYPE_PROPERTYNAME)
+ {
+ if (psFilterNode->pszValue &&
+ strstr(psFilterNode->pszValue, ":"))
+ {
+ tokens = msStringSplit(psFilterNode->pszValue, ':', &n);
+ if (tokens && n==2)
+ {
+ msFree(psFilterNode->pszValue);
+ psFilterNode->pszValue = strdup(tokens[1]);
+ }
+ if (tokens && n>0)
+ msFreeCharArray(tokens, n);
+ }
+ }
+ if (psFilterNode->psLeftNode)
+ FLTStripNameSpacesFromPropertyName(psFilterNode->psLeftNode);
+ if (psFilterNode->psRightNode)
+ FLTStripNameSpacesFromPropertyName(psFilterNode->psRightNode);
+ }
+
+}
+
/************************************************************************/
/* FLTPreParseFilterForAlias */
/* */
@@ -4008,6 +4038,9 @@
if (psFilterNode && map && i>=0 && i<map->numlayers)
{
+ /*strip name speces befor hand*/
+ FLTStripNameSpacesFromPropertyName(psFilterNode);
+
lp = GET_LAYER(map, i);
if (msLayerOpen(lp) == MS_SUCCESS && msLayerGetItems(lp) == MS_SUCCESS)
{
Modified: trunk/mapserver/mapwfs.c
===================================================================
--- trunk/mapserver/mapwfs.c 2010-02-12 15:49:26 UTC (rev 9791)
+++ trunk/mapserver/mapwfs.c 2010-02-12 21:47:09 UTC (rev 9792)
@@ -1171,7 +1171,39 @@
{
if (strlen(tokens[i]) > 0)
{
- papszPropertyName[i] = strdup(tokens[i]);
+ /*trim namespaces. PROPERTYNAME=(ns:prop1,ns:prop2)(prop1)*/
+ if (strstr(tokens[i], ":"))
+ {
+ char **tokens1, **tokens2;
+ int n1=0,n2=0,l=0;
+ char *pszTmp = NULL;
+
+ tokens1 = msStringSplit(tokens[i], ',', &n1);
+ for (l=0;l<n1;l++)
+ {
+ if (pszTmp!=NULL)
+ pszTmp = msStringConcatenate(pszTmp,",");
+
+ if (strstr(tokens1[l],":"))
+ {
+ tokens2 = msStringSplit(tokens1[l], ':', &n2);
+ if (tokens2 && n2==2)
+ pszTmp = msStringConcatenate(pszTmp, tokens2[1]);
+ else
+ pszTmp = msStringConcatenate(pszTmp,tokens1[l]);
+ if (tokens2 && n2>0)
+ msFreeCharArray(tokens2, n2);
+ }
+ else
+ pszTmp = msStringConcatenate(pszTmp,tokens1[l]);
+ }
+ papszPropertyName[i] = strdup(pszTmp);
+ msFree(pszTmp);
+ if (tokens1 && n1>0)
+ msFreeCharArray(tokens1, n1);
+ }
+ else
+ papszPropertyName[i] = strdup(tokens[i]);
/* remove trailing ) */
papszPropertyName[i][strlen(papszPropertyName[i])-1] = '\0';
}
More information about the mapserver-commits
mailing list