Преглед изворни кода

fixed xmlns for DescribeFeature - use default_objects

Piotr Labudda пре 9 година
родитељ
комит
8600dbce3e

+ 2 - 2
SE/se-lib/Api/WfsNs.php

@@ -11,7 +11,7 @@ class Api_WfsNs {
     $listNs["{$baseNsUri}"] = 'p5';
 		$listNs["{$baseNsUri}/default_db"] = 'default_db';
 		$listNs["{$baseNsUri}/default_objects"] = 'default_objects';
-		$listNs["{$baseNsUri}/objects"] = 'p5_objects';
+		$listNs["{$baseNsUri}/objects"] = 'p5_objects';// TODO: to remove
 		return $listNs;
   }
 
@@ -22,7 +22,7 @@ class Api_WfsNs {
     $nsUri = V::get($nsPrefix, null, $nsMap);
     if (!$nsUri) {
       if ('p5_default_db' == $nsPrefix) return V::get('default_db', null, $nsMap);
-      if ('default_objects' == $nsPrefix) return V::get('p5_objects', null, $nsMap);
+      if ('objects' == $nsPrefix) return V::get('p5_objects', null, $nsMap);
       if ('default_db__x3A__' == substr($nsPrefix, 0, 17)) return $nsMap['default_db'] . "/" . substr($nsPrefix, 17);
     }
     return $nsUri;

+ 11 - 4
SE/se-lib/Api/WfsServerBase.php

@@ -1377,15 +1377,14 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 		// <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://webgis.regione.sardegna.it:80/geoserver/schemas/gml/2.1.2/feature.xsd"/>
 		//	<xsd:element name="{type}" substitutionGroup="gml:_Feature" type="dbu:{typeName}"/>
 
+		$nsMap = Api_WfsNs::getNsList();// uri => prefix
+
 		$dom = new DOMDocument('1.0', 'utf-8');
 		$dom->formatOutput = true;
 		$dom->preserveWhiteSpace = false;
 		$rootNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:schema');
 		$dom->appendChild($rootNode);
 		$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:gml', 'http://www.opengis.net/gml');
-		foreach (Api_WfsNs::getNsList() as $uri => $prefix) {
-			$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', "xmlns:{$prefix}", $uri);
-		}
 		$rootNode->setAttribute('elementFormDefault', 'qualified');
 		// $rootNode->setAttribute('targetNamespace', Api_WfsNs::getNsUri('p5_default_db'));// TODO:? what targetNamespace if showing types from p5_objects and p5_default_db
 		{// <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="...../gml/2.1.2/feature.xsd"/>
@@ -1401,7 +1400,11 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 
 			$typeName = "{$nsPrefix}:{$type}";
 			$acl = $this->getAclFromTypeName($typeName);
-			$rootNode->setAttribute('targetNamespace', Api_WfsNs::getNsUri($acl->getSourceName()));
+			{// xmlns and targetNamespace for root element
+				$aclNamespace = Api_WfsNs::getNsUri($acl->getSourceName());
+				$rootNode->setAttribute('targetNamespace', $aclNamespace);
+				if (!array_key_exists($aclNamespace, $nsMap)) $nsMap[$aclNamespace] = $nsPrefix;
+			}
 			$typeName = $type . 'Type';
 			$fldList = $this->_getFieldListFromAcl($acl);
 			DBG::_('DBG_XSD', '>1', "field list", $fldList, __CLASS__, __FUNCTION__, __LINE__);
@@ -1540,6 +1543,10 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 			}
 		}
 
+		foreach ($nsMap as $uri => $prefix) {
+			$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', "xmlns:{$prefix}", $uri);
+		}
+
 		return $dom->saveXML();
 	}
 

+ 0 - 0
SE/se-lib/Schema/ZaliczkaStorageAcl.php → SE/se-lib/Schema/DefaultDb/zaliczka/ZaliczkaStorageAcl.php