[mapguide-commits] r5391 - in trunk/MgDev: Server/src/Services/Feature Server/src/Wfs Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Nov 15 01:20:44 EST 2010


Author: liuar
Date: 2010-11-14 22:20:43 -0800 (Sun, 14 Nov 2010)
New Revision: 5391

Modified:
   trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
   trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
   trunk/MgDev/Web/src/HttpHandler/XmlParser.cpp
   trunk/MgDev/Web/src/HttpHandler/XmlParser.h
Log:
Ticket #1523 (Failed to apply filter on MapGuide published WFS)

1. Fix an xml parser issue. The original implementation of MgXmlComment is not correct, which stop reading the xml comments elements while reaches "<" or "/>". This submission fixes this by stopping parse the comments elements while reaches "-->" 
   This issue causes most of the SpatialOperators and GeometryOperands failed to be loaded.

2. Fix the impotent filter issue. I updated the wfs filter in [5209] incorrectly. If the wfsFilter doesn't contains text GEOM, the wfsFilter will be ignored.

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp	2010-11-13 18:14:35 UTC (rev 5390)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp	2010-11-15 06:20:43 UTC (rev 5391)
@@ -1849,21 +1849,24 @@
 
         Ptr<MgPropertyDefinitionCollection> properties = fc->GetProperties();
         MgOgcFilterUtil u;
-        if(wfsFilter.find(GEOM_PROP_TAG, 0) != STRING::npos)
+        
+        for(int i = 0; i<properties->GetCount(); i++)
         {
-            for(int i = 0; i<properties->GetCount(); i++)
+            Ptr<MgPropertyDefinition> prop = properties->GetItem(i);
+            if(prop->GetPropertyType() == MgFeaturePropertyType::GeometricProperty)
             {
-                Ptr<MgPropertyDefinition> prop = properties->GetItem(i);
-                if(prop->GetPropertyType() == MgFeaturePropertyType::GeometricProperty)
+                STRING ogcFilter = wfsFilter;
+
+                if(wfsFilter.find(GEOM_PROP_TAG, 0) != STRING::npos)
                 {
-                    STRING ogcFilter = MgUtil::ReplaceString(wfsFilter,GEOM_PROP_TAG.c_str(),prop->GetName().c_str());
+                    ogcFilter = MgUtil::ReplaceString(wfsFilter,GEOM_PROP_TAG.c_str(),prop->GetName().c_str());
+                }
+                if(!fdoFilterString.empty())
+                {
+                    fdoFilterString += L" OR "; //NOXLATE
+                }
 
-                    if(!fdoFilterString.empty())
-                    {
-                        fdoFilterString += L" OR ";
-                    }
-                    fdoFilterString += u.Ogc2FdoFilter(ogcFilter, trans, prop->GetName(), properties);
-                }
+                fdoFilterString += u.Ogc2FdoFilter(ogcFilter, trans, prop->GetName(), properties);
             }
         }
 

Modified: trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
===================================================================
--- trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd	2010-11-13 18:14:35 UTC (rev 5390)
+++ trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd	2010-11-15 06:20:43 UTC (rev 5391)
@@ -54,7 +54,7 @@
  <Define item="Keywords.xml"><ows:Keyword>&Enum.item;</ows:Keyword></Define>
  <Define item="ParameterValue.xml"><ows:Value>&Enum.item;</ows:Value></Define>
  <Define item="ParameterValue.Version.xml"><ows:Value>&Enum.item.number;</ows:Value></Define>
- <Define item="GeometryOperands.xml"><ogc:GeometryOperand>&Enum.item;</ogc:GeometryOperand></Define>
+ <Define item="GeometryOperands.xml"><ogc:GeometryOperand>gml:&Enum.item;</ogc:GeometryOperand></Define>
  <Define item="SpatialOperators.xml"><ogc:SpatialOperator name="&Enum.item;"/></Define>
  <Define item="ComparisonOperators.xml"><ogc:ComparisonOperator>&Enum.item;</ogc:ComparisonOperator></Define>
  <Define item="FunctionNames.xml"><ogc:FunctionName nArgs="&Enum.item.args;">&Enum.item;</ogc:FunctionName></Define>

Modified: trunk/MgDev/Web/src/HttpHandler/XmlParser.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/XmlParser.cpp	2010-11-13 18:14:35 UTC (rev 5390)
+++ trunk/MgDev/Web/src/HttpHandler/XmlParser.cpp	2010-11-15 06:20:43 UTC (rev 5391)
@@ -490,7 +490,8 @@
 MgXmlComment::MgXmlComment(CPSZ pszString,xsize_t& iStartStop)
 {
     m_pszStart = pszString + iStartStop;
-    m_iLen = Advance(m_pszStart);
+    CPSZ psz = AdvanceToCommentEnd(m_pszStart + /*len("<!--")*/ 4);
+    m_iLen = (xsize_t) (psz - m_pszStart);
     iStartStop += m_iLen;
     m_iLen++; // advance to include the close angle bracket.
 }
@@ -501,6 +502,16 @@
     return STRING(pszStart,m_iLen - 7);  // ignore the --> (three)
 }
 
+CPSZ MgXmlComment::AdvanceToCommentEnd(CPSZ psz)
+{
+    for(;;psz++) {
+        if(psz[0] == '0')
+            return psz; // Trouble!!!
+        else if(psz[0] == '-' && psz[1] == '-' && psz[2] == '>')
+            return psz+2; // point to that final '>'
+    }
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 
 

Modified: trunk/MgDev/Web/src/HttpHandler/XmlParser.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/XmlParser.h	2010-11-13 18:14:35 UTC (rev 5390)
+++ trunk/MgDev/Web/src/HttpHandler/XmlParser.h	2010-11-15 06:20:43 UTC (rev 5391)
@@ -276,6 +276,9 @@
     MgXmlNodeType Type() const { return keComment; }
 
     STRING Text() const;
+
+private:
+    CPSZ AdvanceToCommentEnd(CPSZ psz);
 };
 
 



More information about the mapguide-commits mailing list