[Mapbender-commits] r9687 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Feb 16 08:54:17 PST 2017


Author: armin11
Date: 2017-02-16 08:54:17 -0800 (Thu, 16 Feb 2017)
New Revision: 9687

Modified:
   trunk/mapbender/http/php/wfs.php
Log:
Bugfix

Modified: trunk/mapbender/http/php/wfs.php
===================================================================
--- trunk/mapbender/http/php/wfs.php	2017-02-16 15:09:44 UTC (rev 9686)
+++ trunk/mapbender/http/php/wfs.php	2017-02-16 16:54:17 UTC (rev 9687)
@@ -218,10 +218,22 @@
 	}
 }
 
-if($featuretypeId && ($featureTypeList = $xpath->query('/wfs:WFS_Capabilities/wfs:FeatureTypeList')[0])){
-    $itemsToRemove = $xpath->query('./wfs:FeatureType[./wfs:Name/text()!="'.$xml_row["fname"].'"]', $featureTypeList);
-    foreach ($itemsToRemove as $itemToRemove) {
-        $featureTypeList->removeChild($itemToRemove);
+
+//delete all unrequested featuretypes from capabilities
+$featureTypeList = $xpath->query('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType');//as domnodelist
+
+if($featuretypeId && $featureTypeList->length > 0){
+    for ($i = 0; $i < $featureTypeList->length; $i++) {
+        $temp = $featureTypeList->item($i);
+	$childs = $temp->childNodes;
+	foreach($childs as $child) {
+		if ($child->nodeName == "Name") {
+			$e = new mb_exception($child->nodeValue);
+			if ($child->nodeValue !== $xml_row["fname"]) {
+			    $child->parentNode->parentNode->removeChild($temp);
+			}
+		}
+	}
     }
 }
 



More information about the Mapbender_commits mailing list