[Mapbender-commits] r9680 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Feb 8 06:07:31 PST 2017
Author: armin11
Date: 2017-02-08 06:07:31 -0800 (Wed, 08 Feb 2017)
New Revision: 9680
Modified:
trunk/mapbender/http/classes/class_iso19139.php
Log:
Fix for xml parsing of license and accessConstraints handling
Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php 2017-02-08 07:46:05 UTC (rev 9679)
+++ trunk/mapbender/http/classes/class_iso19139.php 2017-02-08 14:07:31 UTC (rev 9680)
@@ -509,33 +509,27 @@
$second = $restrictionCodeAttributeValue[1];
if ($first == 'license' && $second == 'otherRestrictions') {
//search for json
- $otherConstraints = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo//gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gco:CharacterString');
- if (json_decode(stripslashes($otherConstraints[0])) === NULL) {
- //no json found - use string as constraints text and look in second entry
- $this->fees = $otherConstraints[0];
- if (json_decode(stripslashes($otherConstraints[1])) === NULL) {
- //no json found - end parsing
- } else {
+ $otherConstraints = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo//gmd:resourceConstraints/gmd:MD_LegalConstraints[gmd:useConstraints/gmd:MD_RestrictionCode/@codeListValue="otherRestrictions"]/gmd:otherConstraints/gco:CharacterString');
+ $jsonFound = false;
+ $otherConstraintsFreeText = "";
+ foreach($otherConstraints as $otherConstraint) {
+ if (json_decode(stripslashes($otherConstraint)) !== NULL) {
//parse json
- $standardizedLicense = json_decode(stripslashes($otherConstraints[1]));
+ $standardizedLicense = json_decode(stripslashes($otherConstraint));
//Look for source
$this->licenseSourceNote = $standardizedLicense->quelle;
- $this->licenseJson = stripslashes($otherConstraints[1]);
+ $this->licenseJson = stripslashes($otherConstraint);
//$e = new mb_exception("class_iso19139.php: licenseSourceNote: ".$this->licenseSourceNote);
+ } else {
+ $otherConstraintsFreeText .= $otherConstraint.";";
}
- } else {
- //parse json
- $standardizedLicense = json_decode(stripslashes($otherConstraints[0]));
- //Look for source
- $this->licenseSourceNote = $standardizedLicense->quelle;
- $this->licenseJson = stripslashes($otherConstraints[1]);
- //search in the second entry for a freetext object
- if ($otherConstraints[1] != ''){
- $this->fees = $otherConstraints[1];
- }
- }
+ }
+ $this->fees = rtrim($otherConstraintsFreeText, ';');
}
$e = new mb_notice("class_iso19139.php: licenseSourceNote: ".$this->licenseSourceNote." - fees: ".$this->fees);
+ $accessConstraints = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo//gmd:resourceConstraints/gmd:MD_LegalConstraints[gmd:accessConstraints/gmd:MD_RestrictionCode/@codeListValue="otherRestrictions"]/gmd:otherConstraints/gco:CharacterString');
+ $this->accessConstraints = $accessConstraints[0];
+ //$e = new mb_exception("accessConstraints: ".$accessConstraints[0]);
$this->resourceResponsibleParty = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString');
$this->resourceResponsibleParty = $this->resourceResponsibleParty[0];
$this->resourceContactEmail = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString');
More information about the Mapbender_commits
mailing list