diff --git a/src/Ign/Component/WFS/Client.php b/src/Ign/Component/WFS/Client.php index 3142ca95d494fa531075a4f98006ec7f07655108..d807e0fc04a4ad98b69eb81775f490c65ce1c22f 100644 --- a/src/Ign/Component/WFS/Client.php +++ b/src/Ign/Component/WFS/Client.php @@ -29,6 +29,9 @@ class Client { */ private $proxy; + const DEFAULT_FORMAT = "application/gml+xml; version=3.2"; +// const DEFAULT_FORMAT = "gml32"; + /** * Constructor * @@ -70,13 +73,17 @@ class Client { } $xpath = new \DOMXPath( $document ); + $xpath->registerNamespace('wfs', "http://www.opengis.net/wfs/2.0"); + $capabilities = $xpath->query( '//wfs:WFS_Capabilities' ); - + if ( ! $capabilities || $capabilities->length == 0){ return false; } return true; - + + + } catch ( \Exception $e ) { return false; } catch ( \DOMException $e) { @@ -84,6 +91,25 @@ class Client { } } + /** + * hasValidOutputFormat + * + * @return boolean + */ + public function hasValidOutputFormat(){ + + $formats = $this->getFeatureFormats(); + + if ( in_array(self::DEFAULT_FORMAT,$formats ) ){ + return true; + } + return false; + } + + + + + /** * getUpdateSequence @@ -159,7 +185,9 @@ class Client { return false; } + $featureList = $this->featureListToArray( $features ); + return $featureList; } @@ -199,7 +227,7 @@ class Client { $typeName, $featureFilter ){ - $query = '<wfs:GetFeature service="WFS" outputFormat="gml32" '; + $query = '<wfs:GetFeature service="WFS" outputFormat="'.self::DEFAULT_FORMAT.'" '; $query.= 'xmlns:wfs="http://www.opengis.net/wfs" '; $query.= 'xmlns:ogc="http://www.opengis.net/ogc" '; $query.= 'xmlns:gml="http://www.opengis.net/gml" >'; @@ -319,6 +347,7 @@ class Client { $document->loadXML( $features ); $xpath = new \DOMXPath( $document ); + $xpath->registerNamespace('wfs', "http://www.opengis.net/wfs/2.0"); $members = $xpath->query('//wfs:FeatureCollection/wfs:member/*'); @@ -376,6 +405,7 @@ class Client { $document = new \DOMDocument; $document->loadXML( $data ); $xpath = new \DOMXPath( $document ); + $xpath->registerNamespace('wfs', "http://www.opengis.net/wfs/2.0"); $updateSequenceElement = $xpath->query('//wfs:WFS_Capabilities'); if ( $updateSequenceElement->length == 0){ @@ -397,6 +427,8 @@ class Client { $document = new \DOMDocument; $document->loadXML( $data ); $xpath = new \DOMXPath( $document ); + $xpath->registerNamespace('wfs', "http://www.opengis.net/wfs/2.0"); + $xpath->registerNamespace('ows', 'http://www.opengis.net/ows'); $formats = $xpath ->query( @@ -427,6 +459,7 @@ class Client { $xpath = new \DOMXPath( $document ); $xpath->registerNamespace( 'xsd', 'http://schemas.opengis.net/gml/3.2.1/gml.xsd' ); + $xpath->registerNamespace('wfs', "http://www.opengis.net/wfs/2.0"); $types = $xpath->query( '//xsd:schema/xsd:complexType' ); @@ -483,6 +516,7 @@ class Client { $xmlDoc->loadXML ( $content ); $xpath = new \DOMXPath( $xmlDoc ); + $xpath->registerNamespace('wfs', "http://www.opengis.net/wfs/2.0"); $xpath->registerNamespace('ows', 'http://www.opengis.net/ows'); $error = $xpath->query('//ows:ExceptionReport');