/**
*
* Clase para generar la estructura del metadato en los diferentes formatos admitidos por GEONETWORK
* @author Joguer Tacas Misaico(tacasmisaico@gmail.com)
* @version 1.0.0
*
*/
class Metadata{
private $_xmlns;
private $_gmd;
private $_xsi;
private $_gml;
private $_gts;
private $_gco;
private $_geonet;
private $_codeList;
private $_srv;
/**
*
* Método constructor que inicializa los atributos estáticos
*/
public function __construct(){
$this->_xmlns = 'http://www.w3.org/2000/xmlns/';
$this->_gmd = 'http://www.isotc211.org/2005/gmd';
$this->_xsi = 'http://www.w3.org/2001/XMLSchema-instance';
$this->_gml = 'http://www.opengis.net/gml';
$this->_gts = 'http://www.isotc211.org/2005/gts';
$this->_gco = 'http://www.isotc211.org/2005/gco';
$this->_geonet = 'http://www.fao.org/geonetwork';
$this->_codeList = 'http://www.isotc211.org/2005/resources/codeList.xml';
$this->_srv = 'http://www.isotc211.org/2005/srv';
}
/**
*
* Método que se encarga de generar la estructura del xml a almacenar como metadata del documento
* @access private
* @param
* @return DOMDocument
*/
public function generate19139($pName, $pDateTime, $pAbstract, $pGUID, $pLanguage,
$pAuthorName, $pAuthorEntity, $pAuthorEmail, $pProviderName, $pProviderEntity,
$pProviderEmail, $pKeywords, $pUrlDocument, $pFormat, $pVersion,
$pLogo, $pCategory, $pNorma, $pRSIdentifier, $pRSCode){
$doc=new DOMDocument();
$doc->preserveWhiteSpace=false;
$doc->formatOutput=true;
$mdMetadata=$doc->createElementNS($this->_gmd,'gmd:MD_Metadata');
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:xsi', $this->_xsi);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:gml', $this->_gml);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:gts', $this->_gts);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:gco', $this->_gco);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:geonet', $this->_geonet);
$doc->appendChild($mdMetadata);
$fileIdentifier = $doc->createElementNS($this->_gmd, 'fileIdentifier');
$mdMetadata->appendChild($fileIdentifier);
$characterString = $doc->createElementNS($this->_gco, 'CharacterString',$pGUID);
$fileIdentifier->appendChild($characterString);
$language=$doc->createElementNS($this->_gmd,'language');
$mdMetadata->appendChild($language);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','spa');
$language->appendChild($characterString);
$characterSet=$doc->createElementNS($this->_gmd, 'characterSet');
$mdMetadata->appendChild($characterSet);
$mdCharacterSetCode=$doc->createElementNS($this->_gmd,'MD_CharacterSetCode');
$mdCharacterSetCode->setAttribute('codeListValue', 'utf8');
$mdCharacterSetCode->setAttribute('codeList', $this->_codeList.'#MD_CharacterSetCode');
$characterSet->appendChild($mdCharacterSetCode);
$contact= $doc->createElementNS($this->_gmd,'contact');
$mdMetadata->appendChild($contact);
$ciResponsibleParty=$doc->createElementNS($this->_gmd, 'CI_ResponsibleParty');
$contact->appendChild($ciResponsibleParty);
$individualName=$doc->createElementNS($this->_gmd,'individualName');
$ciResponsibleParty->appendChild($individualName);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString',$pAuthorName);//nombre del autor
$individualName->appendChild($characterString);
$organisationName=$doc->createElementNS($this->_gmd, 'organisationName');
$ciResponsibleParty->appendChild($organisationName);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString',$pAuthorEntity);//institucion del autor
$organisationName->appendChild($characterString);
$contactInfo=$doc->createElementNS($this->_gmd,'contactInfo');
$ciResponsibleParty->appendChild($contactInfo);
$ciContact=$doc->createElementNS($this->_gmd, 'CI_Contact');
$contactInfo->appendChild($ciContact);
$phone=$doc->createElementNS($this->_gmd,'phone');
$ciContact->appendChild($phone);
$ciTelephone=$doc->createElementNS($this->_gmd, 'CI_Telephone');
$phone->appendChild($ciTelephone);
$address=$doc->createElementNS($this->_gmd, 'address');
$ciContact->appendChild($address);
$ciAddress=$doc->createElementNS($this->_gmd,'CI_Address');
$address->appendChild($ciAddress);
$electronicMailAddress=$doc->createElementNS($this->_gmd,'electronicMailAddress');
$ciAddress->appendChild($electronicMailAddress);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString',$pAuthorEmail);//correo electronico del author
$electronicMailAddress->appendChild($characterString);
$role= $doc->createElementNS($this->_gmd,'role');
$ciResponsibleParty->appendChild($role);
$ciRoleCode= $doc->createElementNS($this->_gmd,'CI_RoleCode');
$ciRoleCode->setAttribute('codeListValue', '001');
$ciRoleCode->setAttribute('codeList', $this->_codeList.'#CI_RoleCode');
$role->appendChild($ciRoleCode);
$dateStamp= $doc->createElementNS($this->_gmd,'dateStamp');
$mdMetadata->appendChild($dateStamp);
$dateTime=$doc->createElementNS($this->_gco,'DateTime',$pDateTime);//fecha del metadato
$dateTime->setAttributeNS($this->_xmlns,'xmlns:srv', $this->_srv);
$dateStamp->appendChild($dateTime);
$metadataStandardName=$doc->createElementNS($this->_gmd, 'metadataStandardName');
$mdMetadata->appendChild($metadataStandardName);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','ISO 19115:2003/19139');
$characterString->setAttributeNS($this->_xmlns,'xmlns:srv', $this->_srv);
$metadataStandardName->appendChild($characterString);
$metadataStandardVersion=$doc->createElementNS($this->_gmd, 'metadataStandardVersion');
$mdMetadata->appendChild($metadataStandardVersion);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','1.0');
$characterString->setAttributeNS($this->_xmlns,'xmlns:srv', $this->_srv);
$metadataStandardVersion->appendChild($characterString);
$spatialRepresentationInfo=$doc->createElementNS($this->_gmd,'spatialRepresentationInfo');
$mdMetadata->appendChild($spatialRepresentationInfo);
$mdVectorSpatialRepresentation=$doc->createElementNS($this->_gmd,'MD_VectorSpatialRepresentation');
$spatialRepresentationInfo->appendChild($mdVectorSpatialRepresentation);
$topologyLevel =$doc->createElementNS($this->_gmd, 'topologyLevel');
$mdVectorSpatialRepresentation->appendChild($topologyLevel);
$mdTopologyLevelCode=$doc->createElementNS($this->_gmd,'MD_TopologyLevelCode');
$mdTopologyLevelCode->setAttribute('codeListValue', '001');
$mdTopologyLevelCode->setAttribute('codeList', $this->_codeList.'#MD_TopologyLevelCode');
$topologyLevel->appendChild($mdTopologyLevelCode);
$geometricObjects=$doc->createElementNS($this->_gmd, 'geometricObjects');
$mdVectorSpatialRepresentation->appendChild($geometricObjects);
$mdgeometricObjects=$doc->createElementNS($this->_gmd,'MD_GeometricObjects');
$geometricObjects->appendChild($mdgeometricObjects);
$geometricObjectType=$doc->createElementNS($this->_gmd, 'geometricObjectType');
$mdgeometricObjects->appendChild($geometricObjectType);
$mdGeometricObjectTypeCode=$doc->createElementNS($this->_gmd,'MD_GeometricObjectTypeCode');
$mdGeometricObjectTypeCode->setAttribute('codeListValue', '001');
$mdGeometricObjectTypeCode->setAttribute('codeList', $this->_codeList.'#MD_GeometricObjectTypeCode');
$geometricObjectType->appendChild($mdGeometricObjectTypeCode);
$referenceSystemInfo =$doc->createElementNS($this->_gmd,'referenceSystemInfo');
$mdMetadata->appendChild($referenceSystemInfo);
$mdReferenceSystem= $doc->createElementNS($this->_gmd,'MD_ReferenceSystem');
$referenceSystemInfo->appendChild($mdReferenceSystem);
$referenceSysemIdentifier=$doc->createElementNS($this->_gmd,'referenceSystemIdentifier');
$mdReferenceSystem->appendChild($referenceSysemIdentifier);
$rsIdentifier=$doc->createElementNS($this->_gmd, 'RS_Identifier');
$referenceSysemIdentifier->appendChild($rsIdentifier);
$code=$doc->createElementNS($this->_gmd,'code');
$rsIdentifier->appendChild($code);
$characterString=$doc->createElementNS($this->_gco,'CharacterString',$pRSIdentifier); //RS Identifier
$code->appendChild($characterString);
$codeSpace=$doc->createElementNS($this->_gmd,'codeSpace');
$rsIdentifier->appendChild($codeSpace);
$characterString=$doc->createElementNS($this->_gco,'CharacterString',$pRSCode); //WGS 84 Zone
$codeSpace->appendChild($characterString);
$identificationInfo =$doc->createElementNS($this->_gmd, 'identificationInfo');
$mdMetadata->appendChild($identificationInfo);
$mdDataIdentification = $doc->createElementNS($this->_gmd,'MD_DataIdentification');
$identificationInfo->appendChild($mdDataIdentification);
$citation=$doc->createElementNS($this->_gmd,'citation');
$mdDataIdentification->appendChild($citation);
$ciCitation =$doc->createElementNS($this->_gmd, 'CI_Citation');
$citation->appendChild($ciCitation);
$title=$doc->createElementNS($this->_gmd, 'title');
$ciCitation->appendChild($title);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString',$pName);//nombre de metadato
$title->appendChild($characterString);
$date =$doc->createElementNS($this->_gmd,'date');
$ciCitation->appendChild($date);
$ciDate=$doc->createElementNS($this->_gmd,'CI_Date');
$date->appendChild($ciDate);
$date =$doc->createElementNS($this->_gmd,'date');
$ciDate->appendChild($date);
$dateTime=$doc->createElementNS($this->_gco,'DateTime',$pDateTime);//fecha
$date->appendChild($dateTime);
$dateType=$doc->createElementNS($this->_gmd,'dateType');
$ciDate->appendChild($dateType);
$ciDateTypeCode= $doc->createElementNS($this->_gmd,'CI_DateTypeCode');
$ciDateTypeCode->setAttribute('codeListValue', '001');
$ciDateTypeCode->setAttribute('codeList', $this->_codeList.'#CI_DateTypeCode');
$dateType->appendChild($ciDateTypeCode);
$presentationForm= $doc->createElementNS($this->_gmd, 'presentationForm');
$ciCitation->appendChild($presentationForm);
$ciPresentationFormCode=$doc->createElementNS($this->_gmd,'CI_PresentationFormCode');
$ciPresentationFormCode->setAttribute('codeListValue', '005');
$ciPresentationFormCode->setAttribute('codeList', $this->_codeList.'#CI_PresentationFormCode');
$presentationForm->appendChild($ciPresentationFormCode);
$abstract=$doc->createElementNS($this->_gmd,'abstract');
$mdDataIdentification->appendChild($abstract);
$characterString=$doc->createElementNS($this->_gco,'CharacterString',$pAbstract);//resumen
$abstract->appendChild($characterString);
$status = $doc->createElementNS($this->_gmd, 'status');
$mdDataIdentification->appendChild($status);
$mdProgressCode=$doc->createElementNS($this->_gmd, 'MD_ProgressCode');
$mdProgressCode->setAttribute('codeListValue', '001');
$mdProgressCode->setAttribute('codeList', $this->_codeList.'#MD_ProgressCode');
$status->appendChild($mdProgressCode);
$pointOfContact=$doc->createElementNS($this->_gmd,'pointOfContact');
$mdDataIdentification->appendChild($pointOfContact);
$ciResponsibleParty=$doc->createElementNS($this->_gmd,'CI_ResponsibleParty');
$pointOfContact->appendChild($ciResponsibleParty);
$individualName=$doc->createElementNS($this->_gmd,'individualName');
$ciResponsibleParty->appendChild($individualName);
$characterString=$doc->createElementNS($this->_gco,'CharacterString', $pProviderName);//author del dato
$individualName->appendChild($characterString);
$organisationName= $doc->createElementNS($this->_gmd, 'organisationName');
$ciResponsibleParty->appendChild($organisationName);
$characterString=$doc->createElementNS($this->_gco,'CharacterString', $pProviderEntity);//institucion del author
$organisationName->appendChild($characterString);
$contactInfo=$doc->createElementNS($this->_gmd,'contactInfo');
$ciResponsibleParty->appendChild($contactInfo);
$ciContact=$doc->createElementNS($this->_gmd, 'CI_Contact');
$contactInfo->appendChild($ciContact);
$phone=$doc->createElementNS($this->_gmd,'phone');
$ciContact->appendChild($phone);
$ciTelephone=$doc->createElementNS($this->_gmd, 'CI_Telephone');
$phone->appendChild($ciTelephone);
$address = $doc->createElementNS($this->_gmd, 'address');
$ciContact->appendChild($address);
$ciAddress = $doc->createElementNS($this->_gmd,'CI_Address');
$address->appendChild($ciAddress);
$electronicMailAddress = $doc->createElementNS($this->_gmd,'electronicMailAddress');
$ciAddress->appendChild($electronicMailAddress);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString',$pProviderEmail);//correo electronico del author
$electronicMailAddress->appendChild($characterString);
$role= $doc->createElementNS($this->_gmd,'role');
$ciResponsibleParty->appendChild($role);
$ciRoleCode = $doc->createElementNS($this->_gmd,'CI_RoleCode');
$ciRoleCode->setAttribute('codeListValue', '002');
$ciRoleCode->setAttribute('codeList', $this->_codeList.'#CI_RoleCode');
$role->appendChild($ciRoleCode);
$graphicOverview = $doc->createElementNS($this->_gmd, 'graphicOverview');
$mdDataIdentification->appendChild($graphicOverview);
$mdBrowseGraphic = $doc->createElementNS($this->_gmd,'MD_BrowseGraphic');
$graphicOverview->appendChild($mdBrowseGraphic);
$fileName = $doc->createElementNS($this->_gmd, 'fileName');
$mdBrowseGraphic->appendChild($fileName);
$characterString = $doc->createElementNS($this->_gco,'CharacterString',$pLogo);//logo de la institucion
$fileName->appendChild($characterString);
$fileDescription=$doc->createElementNS($this->_gmd,'fileDescription');
$mdBrowseGraphic->appendChild($fileDescription);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','thumbnail');
$fileDescription->appendChild($characterString);
$fileType=$doc->createElementNS($this->_gmd,'fileType');
$mdBrowseGraphic->appendChild($fileType);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','png');
$fileType->appendChild($characterString);
$descriptiveKeywords = $doc->createElementNS($this->_gmd,'descriptiveKeywords');
$mdDataIdentification->appendChild($descriptiveKeywords);
$mdKeywords=$doc->createElementNS($this->_gmd,'MD_Keywords');
$descriptiveKeywords->appendChild($mdKeywords);
$keyword = $doc->createElementNS($this->_gmd, 'keyword');
$mdKeywords->appendChild($keyword);
$characterString = $doc->createElementNS($this->_gco,'CharacterString',$pKeywords);//keywords
$keyword->appendChild($characterString);
$type = $doc->createElementNS($this->_gmd,'type');
$mdKeywords->appendChild($type);
$mdKeywordTypeCode=$doc->createElementNS($this->_gmd, 'MD_KeywordTypeCode');
$mdKeywordTypeCode->setAttribute('codeListValue', '005');
$mdKeywordTypeCode->setAttribute('codeList', $this->_codeList.'#MD_KeywordTypeCode');
$type->appendChild($mdKeywordTypeCode);
$spatialRepresentationType = $doc->createElementNS($this->_gmd, 'spatialRepresentationType');
$mdDataIdentification->appendChild($spatialRepresentationType);
$mdSpatialRepresentationTypeCode= $doc->createElementNS($this->_gmd, 'MD_SpatialRepresentationTypeCode');
$mdSpatialRepresentationTypeCode->setAttribute('codeListValue', '001');
$mdSpatialRepresentationTypeCode->setAttribute('codeList', $this->_codeList.'#MD_SpatialRepresentationTypeCode');
$spatialRepresentationType->appendChild($mdSpatialRepresentationTypeCode);
$spatialResolution = $doc->createElementNS($this->_gmd, 'spatialResolution');
$mdDataIdentification->appendChild($spatialResolution);
$mdResolution = $doc->createElementNS($this->_gmd,'MD_Resolution');
$spatialResolution->appendChild($mdResolution);
$equivalentScale= $doc->createElementNS($this->_gmd,'equivalentScale');
$mdResolution->appendChild($equivalentScale);
$mdRepresentativeFraction = $doc->createElementNS($this->_gmd,'MD_RepresentativeFraction');
$equivalentScale->appendChild($mdRepresentativeFraction);
$denominator= $doc->createElementNS($this->_gmd,'denominator');
$mdRepresentativeFraction->appendChild($denominator);
$integer = $doc->createElementNS($this->_gco,'Integer','50000');//la scala
$denominator->appendChild($integer);
$language = $doc->createElementNS($this->_gmd,'language');
$mdDataIdentification->appendChild($language);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString',$pLanguage);//idioma
$language->appendChild($characterString);
$characterSet = $doc->createElementNS($this->_gmd, 'characterSet');
$mdDataIdentification->appendChild($characterSet);
$mdCharacterSetCode = $doc->createElementNS($this->_gmd,'MD_CharacterSetCode');
$mdCharacterSetCode->setAttribute('codeListValue', 'utf8');
$mdCharacterSetCode->setAttribute('codeList', $this->_codeList.'#MD_CharacterSetCode');
$characterSet->appendChild($mdCharacterSetCode);
$topicCategory = $doc->createElementNS($this->_gmd,'topicCategory');
$mdDataIdentification->appendChild($topicCategory);
$mdTopicCategoryCode = $doc->createElementNS($this->_gmd,'MD_TopicCategoryCode',$pCategory);//categoría
$topicCategory->appendChild($mdTopicCategoryCode);
$extent = $doc->createElementNS($this->_gmd,'extent');
$mdDataIdentification->appendChild($extent);
$exExtent = $doc->createElementNS($this->_gmd, 'EX_Extent');
$extent->appendChild($exExtent);
$geographicElement = $doc->createElementNS($this->_gmd, 'geographicElement');
$exExtent->appendChild($geographicElement);
$exGeographicBoundingBox = $doc->createElementNS($this->_gmd,'EX_GeographicBoundingBox');
$geographicElement->appendChild($exGeographicBoundingBox);
$westBoundLongitude = $doc->createElementNS($this->_gmd,'westBoundLongitude');
$exGeographicBoundingBox->appendChild($westBoundLongitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -81.35515);
$westBoundLongitude->appendChild($decimal);
$eastBoundLongitude = $doc->createElementNS($this->_gmd,'eastBoundLongitude');
$exGeographicBoundingBox->appendChild($eastBoundLongitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -68.6739);
$eastBoundLongitude->appendChild($decimal);
$southBoundLatitude = $doc->createElementNS($this->_gmd,'southBoundLatitude');
$exGeographicBoundingBox->appendChild($southBoundLatitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -18.34855);
$southBoundLatitude->appendChild($decimal);
$northBoundLatitude = $doc->createElementNS($this->_gmd,'northBoundLatitude');
$exGeographicBoundingBox->appendChild($northBoundLatitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -0.03687);
$northBoundLatitude->appendChild($decimal);
$distributionInfo = $doc->createElementNS($this->_gmd, 'distributionInfo');
$mdMetadata->appendChild($distributionInfo);
$mdDistribution = $doc->createElementNS($this->_gmd, 'MD_Distribution');
$distributionInfo->appendChild($mdDistribution);
$distributionFormat = $doc->createElementNS($this->_gmd, 'distributionFormat');
$mdDistribution->appendChild($distributionFormat);
$mdFormat = $doc->createElementNS($this->_gmd,'MD_Format');
$distributionFormat->appendChild($mdFormat);
$name = $doc->createElementNS($this->_gmd,'name');
$mdFormat->appendChild($name);
$characterString = $doc->createElementNS($this->_gco,'CharacterString', $pFormat);//formato
$name->appendChild($characterString);
$version = $doc->createElementNS($this->_gmd,'version');
$mdFormat->appendChild($version);
$characterString = $doc->createElementNS($this->_gco,'CharacterString', $pVersion);//version
$version->appendChild($characterString);
$transferOptions = $doc->createElementNS($this->_gmd, 'transferOptions');
$mdDistribution->appendChild($transferOptions);
$mdDigitalTransferOptions = $doc->createElementNS($this->_gmd, 'MD_DigitalTransferOptions');
$transferOptions->appendChild($mdDigitalTransferOptions);
$onLine = $doc->createElementNS($this->_gmd, 'onLine');
$mdDigitalTransferOptions->appendChild($onLine);
$ciOnLineResource = $doc->createElementNS($this->_gmd, 'CI_OnlineResource');
$onLine->appendChild($ciOnLineResource);
$linkAge = $doc->createElementNS($this->_gmd, 'linkage');
$ciOnLineResource->appendChild($linkAge);
$url = $doc->createElementNS($this->_gmd, 'URL',$pUrlDocument); //url
$linkAge->appendChild($url);
$protocol = $doc->createElementNS($this->_gmd, 'protocol');
$ciOnLineResource->appendChild($protocol);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','WWW:LINK-1.0-http--link' ); //protocolo
$protocol->appendChild($characterString);
$name = $doc->createElementNS($this->_gmd, 'name');
$name->setAttribute('gco:nilReason', 'missing');
$ciOnLineResource->appendChild($name);
$characterString = $doc->createElementNS($this->_gco,'CharacterString');
$name->appendChild($characterString);
$onLine = $doc->createElementNS($this->_gmd, 'onLine');
$mdDigitalTransferOptions->appendChild($onLine);
$ciOnLineResource = $doc->createElementNS($this->_gmd, 'CI_OnlineResource');
$onLine->appendChild($ciOnLineResource);
$linkAge = $doc->createElementNS($this->_gmd, 'linkage');
$ciOnLineResource->appendChild($linkAge);
$url = $doc->createElementNS($this->_gmd, 'URL',''); //url wms
$linkAge->appendChild($url);
$protocol = $doc->createElementNS($this->_gmd, 'protocol');
$ciOnLineResource->appendChild($protocol);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','' ); //protocolo OGC:WMS-1.1.1-http-get-map
$protocol->appendChild($characterString);
$name = $doc->createElementNS($this->_gmd, 'name');
$ciOnLineResource->appendChild($name);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','');//Nombre de capas o layer separado por comas
$name->appendChild($characterString);
$description = $doc->createElementNS($this->_gmd, 'description');
$ciOnLineResource->appendChild($description);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','');//Url del servicio WMS o Descripcion del servicio
$description->appendChild($characterString);
$dataQualityInfo = $doc->createElementNS($this->_gmd,'dataQualityInfo');
$mdMetadata->appendChild($dataQualityInfo);
$dqDataQuality = $doc->createElementNS($this->_gmd, 'DQ_DataQuality');
$dataQualityInfo->appendChild($dqDataQuality);
$scope = $doc->createElementNS($this->_gmd, 'scope');
$dqDataQuality->appendChild($scope);
$dqScope = $doc->createElementNS($this->_gmd,'DQ_Scope');
$scope->appendChild($dqScope);
$level = $doc->createElementNS($this->_gmd,'level');
$dqScope->appendChild($level);
$mdScopeCode = $doc->createElementNS($this->_gmd, 'MD_ScopeCode');
$mdScopeCode->setAttribute('codeListValue', '001');
$mdScopeCode->setAttribute('codeList', $this->_codeList.'#MD_ScopeCode');
$level->appendChild($mdScopeCode);
$lineage = $doc->createElementNS($this->_gmd,'lineage');
$dqDataQuality->appendChild($lineage);
$liLineage = $doc->createElementNS($this->_gmd, 'LI_Lineage');
$lineage->appendChild($liLineage);
$statement = $doc->createElementNS($this->_gmd, 'statement');
$liLineage->appendChild($statement);
$characterString = $doc->createElementNS($this->_gco, 'CharacterString',$pNorma); // norma de los metadatos
$statement->appendChild($characterString);
$metadataConstraints = $doc->createElementNS($this->_gmd,'metadataConstraints');
$mdMetadata->appendChild($metadataConstraints);
$mdLegalConstraints = $doc->createElementNS($this->_gmd, 'MD_LegalConstraints');
$metadataConstraints->appendChild($mdLegalConstraints);
$accessConstraints = $doc->createElementNS($this->_gmd, 'accessConstraints');
$mdLegalConstraints->appendChild($accessConstraints);
$mdRestrictionCode = $doc->createElementNS($this->_gmd, 'MD_RestrictionCode');
$mdRestrictionCode->setAttribute('codeListValue', '001');
$mdRestrictionCode->setAttribute('codeList', $this->_codeList.'#MD_RestrictionCode');
$accessConstraints->appendChild($mdRestrictionCode);
$useConstraints = $doc->createElementNS($this->_gmd, 'useConstraints');
$mdLegalConstraints->appendChild($useConstraints);
$mdRestrictionCode = $doc->createElementNS($this->_gmd, 'MD_RestrictionCode');
$mdRestrictionCode->setAttribute('codeListValue', '001');
$mdRestrictionCode->setAttribute('codeList', $this->_codeList.'#MD_RestrictionCode');
$useConstraints->appendChild($mdRestrictionCode);
$otherConstraints = $doc->createElementNS($this->_gmd,'otherConstraints');
$mdLegalConstraints->appendChild($otherConstraints);
$characterString = $doc->createElementNS($this->_gco,'CharacterString', '');//otras restricciones
$otherConstraints->appendChild($characterString);
$metadataMaintenance = $doc->createElementNS($this->_gmd, 'metadataMaintenance');
$mdMetadata->appendChild($metadataMaintenance);
$mdMaintenanceInformation = $doc->createElementNS($this->_gmd, 'MD_MaintenanceInformation');
$metadataMaintenance->appendChild($mdMaintenanceInformation);
$maintenanceAndUpdateFrequency = $doc->createElementNS($this->_gmd, 'maintenanceAndUpdateFrequency');
$mdMaintenanceInformation->appendChild($maintenanceAndUpdateFrequency);
$mdMaintenanceFrequencyCode = $doc->createElementNS($this->_gmd,'MD_MaintenanceFrequencyCode');
$mdMaintenanceFrequencyCode->setAttribute('codeListValue', '001');
$mdMaintenanceFrequencyCode->setAttribute('codeList', $this->_codeList.'#MD_MaintenanceFrequencyCode');
$maintenanceAndUpdateFrequency->appendChild($mdMaintenanceFrequencyCode);
$metadata= $doc->saveXML($mdMetadata);
return $metadata;
}
public function generate191392($name,$dateTime,$abstract, $authorName,$authorEntity,$authorEmail,
$providerName,$providerEntity,$providerEmail,$logo,$keywords, $category, $formato, $version, $urlDocument,$norma){
$doc=new DOMDocument();
$doc->preserveWhiteSpace=false;
$doc->formatOutput=true;
$mdMetadata=$doc->createElementNS($this->_gmd,'gmd:MD_Metadata');
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:xsi', $this->_xsi);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:gml', $this->_gml);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:gts', $this->_gts);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:gco', $this->_gco);
$mdMetadata->setAttributeNS($this->_xmlns, 'xmlns:geonet', $this->_geonet);
$doc->appendChild($mdMetadata);
$fileIdentifier = $doc->createElementNS($this->_gmd, 'fileIdentifier');
$mdMetadata->appendChild($fileIdentifier);
$characterString = $doc->createElementNS($this->_gco, 'CharacterString','0e677227-c1be-4b16-bfe9-4c4d0b81ac98');
$fileIdentifier->appendChild($characterString);
$language=$doc->createElementNS($this->_gmd,'language');
$mdMetadata->appendChild($language);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','spa');
$language->appendChild($characterString);
$characterSet=$doc->createElementNS($this->_gmd, 'characterSet');
$mdMetadata->appendChild($characterSet);
$mdCharacterSetCode=$doc->createElementNS($this->_gmd,'MD_CharacterSetCode');
$mdCharacterSetCode->setAttribute('codeListValue', 'utf8');
$mdCharacterSetCode->setAttribute('codeList', $this->_codeList.'#MD_CharacterSetCode');
$characterSet->appendChild($mdCharacterSetCode);
$contact= $doc->createElementNS($this->_gmd,'contact');
$mdMetadata->appendChild($contact);
$ciResponsibleParty=$doc->createElementNS($this->_gmd, 'CI_ResponsibleParty');
$contact->appendChild($ciResponsibleParty);
$individualName=$doc->createElementNS($this->_gmd,'individualName');
$ciResponsibleParty->appendChild($individualName);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','Nombre del autor del Metadato');//nombre del autor
$individualName->appendChild($characterString);
$organisationName=$doc->createElementNS($this->_gmd, 'organisationName');
$ciResponsibleParty->appendChild($organisationName);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','Institución al que pertenece');//institucion del autor
$organisationName->appendChild($characterString);
$contactInfo=$doc->createElementNS($this->_gmd,'contactInfo');
$ciResponsibleParty->appendChild($contactInfo);
$ciContact=$doc->createElementNS($this->_gmd, 'CI_Contact');
$contactInfo->appendChild($ciContact);
$phone=$doc->createElementNS($this->_gmd,'phone');
$ciContact->appendChild($phone);
$ciTelephone=$doc->createElementNS($this->_gmd, 'CI_Telephone');
$phone->appendChild($ciTelephone);
$address=$doc->createElementNS($this->_gmd, 'address');
$ciContact->appendChild($address);
$ciAddress=$doc->createElementNS($this->_gmd,'CI_Address');
$address->appendChild($ciAddress);
$electronicMailAddress=$doc->createElementNS($this->_gmd,'electronicMailAddress');
$ciAddress->appendChild($electronicMailAddress);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','correo@institucion.gob.pe');//correo electronico del author
$electronicMailAddress->appendChild($characterString);
$role= $doc->createElementNS($this->_gmd,'role');
$ciResponsibleParty->appendChild($role);
$ciRoleCode= $doc->createElementNS($this->_gmd,'CI_RoleCode');
$ciRoleCode->setAttribute('codeListValue', '001');
$ciRoleCode->setAttribute('codeList', $this->_codeList.'#CI_RoleCode');
$role->appendChild($ciRoleCode);
$dateStamp= $doc->createElementNS($this->_gmd,'dateStamp');
$mdMetadata->appendChild($dateStamp);
$dateTime=$doc->createElementNS($this->_gco,'DateTime','2008-10-17T13:00:17');//fecha del metadato
$dateTime->setAttributeNS($this->_xmlns,'xmlns:srv', $this->_srv);
$dateStamp->appendChild($dateTime);
$metadataStandardName=$doc->createElementNS($this->_gmd, 'metadataStandardName');
$mdMetadata->appendChild($metadataStandardName);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','ISO 19115:2003/19139');
$characterString->setAttributeNS($this->_xmlns,'xmlns:srv', $this->_srv);
$metadataStandardName->appendChild($characterString);
$metadataStandardVersion=$doc->createElementNS($this->_gmd, 'metadataStandardVersion');
$mdMetadata->appendChild($metadataStandardVersion);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','1.0');
$characterString->setAttributeNS($this->_xmlns,'xmlns:srv', $this->_srv);
$metadataStandardVersion->appendChild($characterString);
$spatialRepresentationInfo=$doc->createElementNS($this->_gmd,'spatialRepresentationInfo');
$mdMetadata->appendChild($spatialRepresentationInfo);
$mdVectorSpatialRepresentation=$doc->createElementNS($this->_gmd,'MD_VectorSpatialRepresentation');
$spatialRepresentationInfo->appendChild($mdVectorSpatialRepresentation);
$topologyLevel =$doc->createElementNS($this->_gmd, 'topologyLevel');
$mdVectorSpatialRepresentation->appendChild($topologyLevel);
$mdTopologyLevelCode=$doc->createElementNS($this->_gmd,'MD_TopologyLevelCode');
$mdTopologyLevelCode->setAttribute('codeListValue', '001');
$mdTopologyLevelCode->setAttribute('codeList', $this->_codeList.'#MD_TopologyLevelCode');
$topologyLevel->appendChild($mdTopologyLevelCode);
$geometricObjects=$doc->createElementNS($this->_gmd, 'geometricObjects');
$mdVectorSpatialRepresentation->appendChild($geometricObjects);
$mdgeometricObjects=$doc->createElementNS($this->_gmd,'MD_GeometricObjects');
$geometricObjects->appendChild($mdgeometricObjects);
$geometricObjectType=$doc->createElementNS($this->_gmd, 'geometricObjectType');
$mdgeometricObjects->appendChild($geometricObjectType);
$mdGeometricObjectTypeCode=$doc->createElementNS($this->_gmd,'MD_GeometricObjectTypeCode');
$mdGeometricObjectTypeCode->setAttribute('codeListValue', '001');
$mdGeometricObjectTypeCode->setAttribute('codeList', $this->_codeList.'#MD_GeometricObjectTypeCode');
$geometricObjectType->appendChild($mdGeometricObjectTypeCode);
$referenceSystemInfo =$doc->createElementNS($this->_gmd,'referenceSystemInfo');
$mdMetadata->appendChild($referenceSystemInfo);
$mdReferenceSystem= $doc->createElementNS($this->_gmd,'MD_ReferenceSystem');
$referenceSystemInfo->appendChild($mdReferenceSystem);
$referenceSysemIdentifier=$doc->createElementNS($this->_gmd,'referenceSystemIdentifier');
$mdReferenceSystem->appendChild($referenceSysemIdentifier);
$rsIdentifier=$doc->createElementNS($this->_gmd, 'RS_Identifier');
$referenceSysemIdentifier->appendChild($rsIdentifier);
$code=$doc->createElementNS($this->_gmd,'code');
$rsIdentifier->appendChild($code);
$characterString=$doc->createElementNS($this->_gco,'CharacterString','EPSG:32718');
$code->appendChild($characterString);
$codeSpace=$doc->createElementNS($this->_gmd,'codeSpace');
$rsIdentifier->appendChild($codeSpace);
$characterString=$doc->createElementNS($this->_gco,'CharacterString','WGS 84 / UTM zona 18S');
$codeSpace->appendChild($characterString);
$identificationInfo =$doc->createElementNS($this->_gmd, 'identificationInfo');
$mdMetadata->appendChild($identificationInfo);
$mdDataIdentification = $doc->createElementNS($this->_gmd,'MD_DataIdentification');
$identificationInfo->appendChild($mdDataIdentification);
$citation=$doc->createElementNS($this->_gmd,'citation');
$mdDataIdentification->appendChild($citation);
$ciCitation =$doc->createElementNS($this->_gmd, 'CI_Citation');
$citation->appendChild($ciCitation);
$title=$doc->createElementNS($this->_gmd, 'title');
$ciCitation->appendChild($title);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','Plantilla de Metadatos Generado por Yoguer');//nombre de metadato
$title->appendChild($characterString);
$date =$doc->createElementNS($this->_gmd,'date');
$ciCitation->appendChild($date);
$ciDate=$doc->createElementNS($this->_gmd,'CI_Date');
$date->appendChild($ciDate);
$date =$doc->createElementNS($this->_gmd,'date');
$ciDate->appendChild($date);
$dateTime=$doc->createElementNS($this->_gco,'DateTime','2008-05-05T16:14:00');//fecha
$date->appendChild($dateTime);
$dateType=$doc->createElementNS($this->_gmd,'dateType');
$ciDate->appendChild($dateType);
$ciDateTypeCode= $doc->createElementNS($this->_gmd,'CI_DateTypeCode');
$ciDateTypeCode->setAttribute('codeListValue', '001');
$ciDateTypeCode->setAttribute('codeList', $this->_codeList.'#CI_DateTypeCode');
$dateType->appendChild($ciDateTypeCode);
$presentationForm= $doc->createElementNS($this->_gmd, 'presentationForm');
$ciCitation->appendChild($presentationForm);
$ciPresentationFormCode=$doc->createElementNS($this->_gmd,'CI_PresentationFormCode');
$ciPresentationFormCode->setAttribute('codeListValue', '005');
$ciPresentationFormCode->setAttribute('codeList', $this->_codeList.'#CI_PresentationFormCode');
$presentationForm->appendChild($ciPresentationFormCode);
$abstract=$doc->createElementNS($this->_gmd,'abstract');
$mdDataIdentification->appendChild($abstract);
$characterString=$doc->createElementNS($this->_gco,'CharacterString','Una sIntesis que proporcione un resumen narrativo del contenido de datos');//resumen
$abstract->appendChild($characterString);
$status = $doc->createElementNS($this->_gmd, 'status');
$mdDataIdentification->appendChild($status);
$mdProgressCode=$doc->createElementNS($this->_gmd, 'MD_ProgressCode');
$mdProgressCode->setAttribute('codeListValue', '001');
$mdProgressCode->setAttribute('codeList', $this->_codeList.'#MD_ProgressCode');
$status->appendChild($mdProgressCode);
$pointOfContact=$doc->createElementNS($this->_gmd,'pointOfContact');
$mdDataIdentification->appendChild($pointOfContact);
$ciResponsibleParty=$doc->createElementNS($this->_gmd,'CI_ResponsibleParty');
$pointOfContact->appendChild($ciResponsibleParty);
$individualName=$doc->createElementNS($this->_gmd,'individualName');
$ciResponsibleParty->appendChild($individualName);
$characterString=$doc->createElementNS($this->_gco,'CharacterString', 'Nombre del proveedor o creador de los datos');//author del dato
$individualName->appendChild($characterString);
$organisationName= $doc->createElementNS($this->_gmd, 'organisationName');
$ciResponsibleParty->appendChild($organisationName);
$characterString=$doc->createElementNS($this->_gco,'CharacterString', 'Institucion al que pertenece');//institucion del author
$organisationName->appendChild($characterString);
$contactInfo=$doc->createElementNS($this->_gmd,'contactInfo');
$ciResponsibleParty->appendChild($contactInfo);
$ciContact=$doc->createElementNS($this->_gmd, 'CI_Contact');
$contactInfo->appendChild($ciContact);
$phone=$doc->createElementNS($this->_gmd,'phone');
$ciContact->appendChild($phone);
$ciTelephone=$doc->createElementNS($this->_gmd, 'CI_Telephone');
$phone->appendChild($ciTelephone);
$address = $doc->createElementNS($this->_gmd, 'address');
$ciContact->appendChild($address);
$ciAddress = $doc->createElementNS($this->_gmd,'CI_Address');
$address->appendChild($ciAddress);
$electronicMailAddress = $doc->createElementNS($this->_gmd,'electronicMailAddress');
$ciAddress->appendChild($electronicMailAddress);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','correo@institucion.gob.pe');//correo electronico del author
$electronicMailAddress->appendChild($characterString);
$role= $doc->createElementNS($this->_gmd,'role');
$ciResponsibleParty->appendChild($role);
$ciRoleCode = $doc->createElementNS($this->_gmd,'CI_RoleCode');
$ciRoleCode->setAttribute('codeListValue', '002');
$ciRoleCode->setAttribute('codeList', $this->_codeList.'#CI_RoleCode');
$role->appendChild($ciRoleCode);
$graphicOverview = $doc->createElementNS($this->_gmd, 'graphicOverview');
$mdDataIdentification->appendChild($graphicOverview);
$mdBrowseGraphic = $doc->createElementNS($this->_gmd,'MD_BrowseGraphic');
$graphicOverview->appendChild($mdBrowseGraphic);
$fileName = $doc->createElementNS($this->_gmd, 'fileName');
$mdBrowseGraphic->appendChild($fileName);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','ideplogo_s.png');//logo de la institucion
$fileName->appendChild($characterString);
$fileDescription=$doc->createElementNS($this->_gmd,'fileDescription');
$mdBrowseGraphic->appendChild($fileDescription);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','thumbnail');
$fileDescription->appendChild($characterString);
$fileType=$doc->createElementNS($this->_gmd,'fileType');
$mdBrowseGraphic->appendChild($fileType);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','png');
$fileType->appendChild($characterString);
$descriptiveKeywords = $doc->createElementNS($this->_gmd,'descriptiveKeywords');
$mdDataIdentification->appendChild($descriptiveKeywords);
$mdKeywords=$doc->createElementNS($this->_gmd,'MD_Keywords');
$descriptiveKeywords->appendChild($mdKeywords);
$keyword = $doc->createElementNS($this->_gmd, 'keyword');
$mdKeywords->appendChild($keyword);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','Ejemplo: Geologia, Fisica');//keywords
$keyword->appendChild($characterString);
$type = $doc->createElementNS($this->_gmd,'type');
$mdKeywords->appendChild($type);
$mdKeywordTypeCode=$doc->createElementNS($this->_gmd, 'MD_KeywordTypeCode');
$mdKeywordTypeCode->setAttribute('codeListValue', '005');
$mdKeywordTypeCode->setAttribute('codeList', $this->_codeList.'#MD_KeywordTypeCode');
$type->appendChild($mdKeywordTypeCode);
$spatialRepresentationType = $doc->createElementNS($this->_gmd, 'spatialRepresentationType');
$mdDataIdentification->appendChild($spatialRepresentationType);
$mdSpatialRepresentationTypeCode= $doc->createElementNS($this->_gmd, 'MD_SpatialRepresentationTypeCode');
$mdSpatialRepresentationTypeCode->setAttribute('codeListValue', '001');
$mdSpatialRepresentationTypeCode->setAttribute('codeList', $this->_codeList.'#MD_SpatialRepresentationTypeCode');
$spatialRepresentationType->appendChild($mdSpatialRepresentationTypeCode);
$spatialResolution = $doc->createElementNS($this->_gmd, 'spatialResolution');
$mdDataIdentification->appendChild($spatialResolution);
$mdResolution = $doc->createElementNS($this->_gmd,'MD_Resolution');
$spatialResolution->appendChild($mdResolution);
$equivalentScale= $doc->createElementNS($this->_gmd,'equivalentScale');
$mdResolution->appendChild($equivalentScale);
$mdRepresentativeFraction = $doc->createElementNS($this->_gmd,'MD_RepresentativeFraction');
$equivalentScale->appendChild($mdRepresentativeFraction);
$denominator= $doc->createElementNS($this->_gmd,'denominator');
$mdRepresentativeFraction->appendChild($denominator);
$integer = $doc->createElementNS($this->_gco,'Integer','50000');//la scala
$denominator->appendChild($integer);
$language = $doc->createElementNS($this->_gmd,'language');
$mdDataIdentification->appendChild($language);
$characterString=$doc->createElementNS($this->_gco, 'CharacterString','spa');
$language->appendChild($characterString);
$characterSet = $doc->createElementNS($this->_gmd, 'characterSet');
$mdDataIdentification->appendChild($characterSet);
$mdCharacterSetCode = $doc->createElementNS($this->_gmd,'MD_CharacterSetCode');
$mdCharacterSetCode->setAttribute('codeListValue', 'utf8');
$mdCharacterSetCode->setAttribute('codeList', $this->_codeList.'#MD_CharacterSetCode');
$characterSet->appendChild($mdCharacterSetCode);
$topicCategory = $doc->createElementNS($this->_gmd,'topicCategory');
$mdDataIdentification->appendChild($topicCategory);
$mdTopicCategoryCode = $doc->createElementNS($this->_gmd,'MD_TopicCategoryCode','geoscientificInformation');//categoría
$topicCategory->appendChild($mdTopicCategoryCode);
$extent = $doc->createElementNS($this->_gmd,'extent');
$mdDataIdentification->appendChild($extent);
$exExtent = $doc->createElementNS($this->_gmd, 'EX_Extent');
$extent->appendChild($exExtent);
$geographicElement = $doc->createElementNS($this->_gmd, 'geographicElement');
$exExtent->appendChild($geographicElement);
$exGeographicBoundingBox = $doc->createElementNS($this->_gmd,'EX_GeographicBoundingBox');
$geographicElement->appendChild($exGeographicBoundingBox);
$westBoundLongitude = $doc->createElementNS($this->_gmd,'westBoundLongitude');
$exGeographicBoundingBox->appendChild($westBoundLongitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -81.35515);
$westBoundLongitude->appendChild($decimal);
$eastBoundLongitude = $doc->createElementNS($this->_gmd,'eastBoundLongitude');
$exGeographicBoundingBox->appendChild($eastBoundLongitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -68.6739);
$eastBoundLongitude->appendChild($decimal);
$southBoundLatitude = $doc->createElementNS($this->_gmd,'southBoundLatitude');
$exGeographicBoundingBox->appendChild($southBoundLatitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -18.34855);
$southBoundLatitude->appendChild($decimal);
$northBoundLatitude = $doc->createElementNS($this->_gmd,'northBoundLatitude');
$exGeographicBoundingBox->appendChild($northBoundLatitude);
$decimal = $doc->createElementNS($this->_gco,'Decimal', -0.03687);
$northBoundLatitude->appendChild($decimal);
$distributionInfo = $doc->createElementNS($this->_gmd, 'distributionInfo');
$mdMetadata->appendChild($distributionInfo);
$mdDistribution = $doc->createElementNS($this->_gmd, 'MD_Distribution');
$distributionInfo->appendChild($mdDistribution);
$distributionFormat = $doc->createElementNS($this->_gmd, 'distributionFormat');
$mdDistribution->appendChild($distributionFormat);
$mdFormat = $doc->createElementNS($this->_gmd,'MD_Format');
$distributionFormat->appendChild($mdFormat);
$name = $doc->createElementNS($this->_gmd,'name');
$mdFormat->appendChild($name);
$characterString = $doc->createElementNS($this->_gco,'CharacterString', 'ArcGIS');//formato
$name->appendChild($characterString);
$version = $doc->createElementNS($this->_gmd,'version');
$mdFormat->appendChild($version);
$characterString = $doc->createElementNS($this->_gco,'CharacterString', '10.0');//version
$version->appendChild($characterString);
$transferOptions = $doc->createElementNS($this->_gmd, 'transferOptions');
$mdDistribution->appendChild($transferOptions);
$mdDigitalTransferOptions = $doc->createElementNS($this->_gmd, 'MD_DigitalTransferOptions');
$transferOptions->appendChild($mdDigitalTransferOptions);
$onLine = $doc->createElementNS($this->_gmd, 'onLine');
$mdDigitalTransferOptions->appendChild($onLine);
$ciOnLineResource = $doc->createElementNS($this->_gmd, 'CI_OnlineResource');
$onLine->appendChild($ciOnLineResource);
$linkAge = $doc->createElementNS($this->_gmd, 'linkage');
$ciOnLineResource->appendChild($linkAge);
$url = $doc->createElementNS($this->_gmd, 'URL','www.institucion.com'); //url
$linkAge->appendChild($url);
$protocol = $doc->createElementNS($this->_gmd, 'protocol');
$ciOnLineResource->appendChild($protocol);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','WWW:LINK-1.0-http--link' ); //protocolo
$protocol->appendChild($characterString);
$name = $doc->createElementNS($this->_gmd, 'name');
$name->setAttribute('gco:nilReason', 'missing');
$ciOnLineResource->appendChild($name);
$characterString = $doc->createElementNS($this->_gco,'CharacterString');
$name->appendChild($characterString);
$onLine = $doc->createElementNS($this->_gmd, 'onLine');
$mdDigitalTransferOptions->appendChild($onLine);
$ciOnLineResource = $doc->createElementNS($this->_gmd, 'CI_OnlineResource');
$onLine->appendChild($ciOnLineResource);
$linkAge = $doc->createElementNS($this->_gmd, 'linkage');
$ciOnLineResource->appendChild($linkAge);
$url = $doc->createElementNS($this->_gmd, 'URL','Direccion Sevicio WMS'); //url
$linkAge->appendChild($url);
$protocol = $doc->createElementNS($this->_gmd, 'protocol');
$ciOnLineResource->appendChild($protocol);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','OGC:WMS-1.1.1-http-get-map' ); //protocolo
$protocol->appendChild($characterString);
$name = $doc->createElementNS($this->_gmd, 'name');
$ciOnLineResource->appendChild($name);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','Nombre de capas o layer separado por comas');
$name->appendChild($characterString);
$description = $doc->createElementNS($this->_gmd, 'description');
$ciOnLineResource->appendChild($description);
$characterString = $doc->createElementNS($this->_gco,'CharacterString','Url del servicio WMS o Descripcion del servicio');
$description->appendChild($characterString);
$dataQualityInfo = $doc->createElementNS($this->_gmd,'dataQualityInfo');
$mdMetadata->appendChild($dataQualityInfo);
$dqDataQuality = $doc->createElementNS($this->_gmd, 'DQ_DataQuality');
$dataQualityInfo->appendChild($dqDataQuality);
$scope = $doc->createElementNS($this->_gmd, 'scope');
$dqDataQuality->appendChild($scope);
$dqScope = $doc->createElementNS($this->_gmd,'DQ_Scope');
$scope->appendChild($dqScope);
$level = $doc->createElementNS($this->_gmd,'level');
$dqScope->appendChild($level);
$mdScopeCode = $doc->createElementNS($this->_gmd, 'MD_ScopeCode');
$mdScopeCode->setAttribute('codeListValue', '001');
$mdScopeCode->setAttribute('codeList', $this->_codeList.'#MD_ScopeCode');
$level->appendChild($mdScopeCode);
$lineage = $doc->createElementNS($this->_gmd,'lineage');
$dqDataQuality->appendChild($lineage);
$liLineage = $doc->createElementNS($this->_gmd, 'LI_Lineage');
$lineage->appendChild($liLineage);
$statement = $doc->createElementNS($this->_gmd, 'statement');
$liLineage->appendChild($statement);
$characterString = $doc->createElementNS($this->_gco, 'CharacterString','Declaracion o resumen de como fueron producidos los datos bajo normas parametros estandares de medicion, Aproximaciones, errores minimos, etc.'); // norma de los metadatos
$statement->appendChild($characterString);
$metadataConstraints = $doc->createElementNS($this->_gmd,'metadataConstraints');
$mdMetadata->appendChild($metadataConstraints);
$mdLegalConstraints = $doc->createElementNS($this->_gmd, 'MD_LegalConstraints');
$metadataConstraints->appendChild($mdLegalConstraints);
$accessConstraints = $doc->createElementNS($this->_gmd, 'accessConstraints');
$mdLegalConstraints->appendChild($accessConstraints);
$mdRestrictionCode = $doc->createElementNS($this->_gmd, 'MD_RestrictionCode');
$mdRestrictionCode->setAttribute('codeListValue', '001');
$mdRestrictionCode->setAttribute('codeList', $this->_codeList.'#MD_RestrictionCode');
$accessConstraints->appendChild($mdRestrictionCode);
$useConstraints = $doc->createElementNS($this->_gmd, 'useConstraints');
$mdLegalConstraints->appendChild($useConstraints);
$mdRestrictionCode = $doc->createElementNS($this->_gmd, 'MD_RestrictionCode');
$mdRestrictionCode->setAttribute('codeListValue', '001');
$mdRestrictionCode->setAttribute('codeList', $this->_codeList.'#MD_RestrictionCode');
$useConstraints->appendChild($mdRestrictionCode);
$otherConstraints = $doc->createElementNS($this->_gmd,'otherConstraints');
$mdLegalConstraints->appendChild($otherConstraints);
$characterString = $doc->createElementNS($this->_gco,'CharacterString', 'Descripcion de otras restricciones');//otras restricciones
$otherConstraints->appendChild($characterString);
$metadataMaintenance = $doc->createElementNS($this->_gmd, 'metadataMaintenance');
$mdMetadata->appendChild($metadataMaintenance);
$mdMaintenanceInformation = $doc->createElementNS($this->_gmd, 'MD_MaintenanceInformation');
$metadataMaintenance->appendChild($mdMaintenanceInformation);
$maintenanceAndUpdateFrequency = $doc->createElementNS($this->_gmd, 'maintenanceAndUpdateFrequency');
$mdMaintenanceInformation->appendChild($maintenanceAndUpdateFrequency);
$mdMaintenanceFrequencyCode = $doc->createElementNS($this->_gmd,'MD_MaintenanceFrequencyCode');
$mdMaintenanceFrequencyCode->setAttribute('codeListValue', '001');
$mdMaintenanceFrequencyCode->setAttribute('codeList', $this->_codeList.'#MD_MaintenanceFrequencyCode');
$maintenanceAndUpdateFrequency->appendChild($mdMaintenanceFrequencyCode);
$metadata= $doc->saveXML();
return $metadata;
}
}
miércoles, 13 de julio de 2011
sábado, 27 de noviembre de 2010
DropDownList en GridView
en esta oportunidad les voy a postear una solución que le dí a un problema que tenía con el dropdownlist dentro de un gridview, aunque me tomó mucho(para ser rápido) tiempo encontrar esto.
el problema que tenía un gridview, pero las columnas no se generaban automáticamente, porque de hecho un campo era un dropdownlist(nada inofensivo), que me traía el estado de cualquier objeto, en mi caso eran capas geográficas, entonces al cambiar de estado tenía que actualizarme automáticamente el registro con el nuevo estado.
bueno sin más chamullo, entramos a ver el código.
No publico código completo porque no viene al caso, pero eso si aqui mi campo que contiene el dropdownlist
Lo primero que debemos de agregar es la propiedad autopostback al dropdownlist y ponerle a true para que automáticamente vaya al servidor, cuando cambiemos de estado.
Además debe de agregarse el evento OnSelectedIndexChanged=”evento_a_ejecutar”
Ahora viene como haremos que al cambiar de estado se ejecute ese evento del onselectedindexchanged??
Bueno para ello nos vamos al codebehind de la página y programamos el evento “evento_a_ejecutar”
protected void evento_a_ejecutar(object sender, EventArgs e)
{
GridViewRow gvr = (GridViewRow)(((Control)sender).NamingContainer);
string fileState = ((DropDownList)gvr.FindControl("ddlEstado")).SelectedValue;
//ahora ya tenemos el valor del dropdownlist y podemos hacer lo que queramos con el, por ejemplo actualizar, para ello sólo tendríamos que obtener el id de dicho registro.
}
Entonce el truco está en convertir el objeto sender en control y este a su vez en un gridview a traves de su propiedad NamingContainer, luego simplemente nos queda buscar los controles que pueda contener el gridview en dicha fila donde ocurrió el evento del dropdownlist.
Pudimos haber simplificado también de esta forma
string fileState = ((DropDownList)sender).SelectedValue;
pero yo necesitaba buscar otros controles en dicha fila del gridview.
el problema que tenía un gridview, pero las columnas no se generaban automáticamente, porque de hecho un campo era un dropdownlist(nada inofensivo), que me traía el estado de cualquier objeto, en mi caso eran capas geográficas, entonces al cambiar de estado tenía que actualizarme automáticamente el registro con el nuevo estado.
bueno sin más chamullo, entramos a ver el código.
No publico código completo porque no viene al caso, pero eso si aqui mi campo que contiene el dropdownlist
Lo primero que debemos de agregar es la propiedad autopostback al dropdownlist y ponerle a true para que automáticamente vaya al servidor, cuando cambiemos de estado.
Además debe de agregarse el evento OnSelectedIndexChanged=”evento_a_ejecutar”
Ahora viene como haremos que al cambiar de estado se ejecute ese evento del onselectedindexchanged??
Bueno para ello nos vamos al codebehind de la página y programamos el evento “evento_a_ejecutar”
protected void evento_a_ejecutar(object sender, EventArgs e)
{
GridViewRow gvr = (GridViewRow)(((Control)sender).NamingContainer);
string fileState = ((DropDownList)gvr.FindControl("ddlEstado")).SelectedValue;
//ahora ya tenemos el valor del dropdownlist y podemos hacer lo que queramos con el, por ejemplo actualizar, para ello sólo tendríamos que obtener el id de dicho registro.
}
Entonce el truco está en convertir el objeto sender en control y este a su vez en un gridview a traves de su propiedad NamingContainer, luego simplemente nos queda buscar los controles que pueda contener el gridview en dicha fila donde ocurrió el evento del dropdownlist.
Pudimos haber simplificado también de esta forma
string fileState = ((DropDownList)sender).SelectedValue;
pero yo necesitaba buscar otros controles en dicha fila del gridview.
Crear una clave SHA1 como la generada por FormsAuthentication.HashPasswordForStoringInConfigFile
Private Function GenerateSHA1(ByVal nombre As String) As String
Dim enc As New UTF8Encoding
Dim data() As Byte = enc.GetBytes(nombre)
Dim result() As Byte
Dim sha As New SHA1CryptoServiceProvider
result = sha.ComputeHash(data)
Dim sb As New StringBuilder
For i As Integer = 0 To result.Length - 1
If result(i) < 16 Then sb.Append("0") End If sb.Append(result(i).ToString("x")) Next Return sb.ToString.ToUpper End Function
Dim enc As New UTF8Encoding
Dim data() As Byte = enc.GetBytes(nombre)
Dim result() As Byte
Dim sha As New SHA1CryptoServiceProvider
result = sha.ComputeHash(data)
Dim sb As New StringBuilder
For i As Integer = 0 To result.Length - 1
If result(i) < 16 Then sb.Append("0") End If sb.Append(result(i).ToString("x")) Next Return sb.ToString.ToUpper End Function
viernes, 7 de agosto de 2009
Generador de Códigos en php
hoy navegando un rato por la red, me encontré con algo interesante como phpobjectgenerator.
pues genera la clase automáticamente, además de las tablas, para que prueben uds mismos les dejo el link.
http://www.phpobjectgenerator.com/
pues genera la clase automáticamente, además de las tablas, para que prueben uds mismos les dejo el link.
http://www.phpobjectgenerator.com/
jueves, 6 de agosto de 2009
Bucles en php
Después de responder este post, pude comprobar lo que ignoraba(ya que vengo programando bastante tiempo), todo este tiempo.
Bueno yendo al asunto en efecto, pude comprobar que sucede lo que afirma maycolalvarez
Textualmente
argy comento esto(adicionando a lo que ya habían comentado)
"y además que una variable que se declara dentro de un ciclo termina cuando el ciclo(valga la redundancia ) termina, es decir que la variable existe sólo dentro del ciclo"
maycolalvarez
"No, esto no aplica para php, el ámbito de variables de php sólo se restringe para los bloques de función, no para los ciclos, como resultado toda variable declarada dentro de un ciclo puede accederse fuera de éste, caso contrario de las variables superglobales, que tienen ámbito en todo el script.
En cambio si declaras una variable en el script, en las funciones del mismo script no tendrán acceso a la variable, sino que la re-declararán, a menos que se utilice la palabra global:
Código PHP:
$mivariable="valor principal";
function metodouno(){
echo 'uno:'.$mivariable; //no imprimirá NADA
}
function metododos(){
global $mivariable;
echo 'dos:'.$mivariable; //imprimirá "valor principal"
}
metodouno();
metododos();
esto ocurre porque php no requiere la declaración explícita de variables y no tiene restricción de tipos (sólo PHP5 al paso de parámetros de clases, pero no una restricción de tipos completa)”
argy
"mmmmm??? a ver si te entendi y si me entendiste, una variable declarada dentro de un bucle while, sólo exisitirá dentro del bucle es decir dentro while($i<100){//sólo aqui, pe $var}, ahora me dices que a $var podré acceder desde fuera del while verdad????. como???
por teoría de ámbito de las variables sé que la variable $var existirá sólo dentro de ese bucle while, entonces si me pierdo de algo como imprimo el contenido de esa variable fuera del bucle???, a menos que yo le haya declarado antes del while."
maycolalvarez
“Lo que te explique anteriormente sólo es para PHP, haz la prueba e inventa para que veas, esto no pasaría con C#, ni con java, por eso hay que tener un poco de cuidado con php.
Tu teoría del ámbito es 100% correcta, pero No aplica para php.
y sí, $var tendrá el último valor asignado al terminar el ciclo, prueba y verás, es mejor cuando uno realiza sus propias pruebas ”
pero aquí hay un detalle que cuando configuro el error a E_ALL|E_STRICT
Código PHP:
while($i<10)
{
$j+=$i;
$i++;
}
echo $j;
//aqui de hecho me imprime 45 (CORRECTO).
//PERO
//si no se declara el contador $i y $j, tenemos el siguiente mensaje
//Notice: Undefined variable: i in D:\Web\agp\index.php on line 3
//Notice: Undefined variable: i in D:\Web\agp\index.php on line 5
//Notice: Undefined variable: j in D:\Web\agp\index.php on line 5
//Notice: Undefined variable: i in D:\Web\agp\index.php on line 6
//si no declaramos $j
//Notice: Undefined variable: j in D:\Web\agp\index.php on line 5
?>
Código PHP:
echo '
';
//ahora si declaramos los dos
$k=0;
$m=0;
while($k<10)
{
$m+=$k;
$k++;
}
echo $m;
//imprime el mismo 45 (CORRECTO), pero no nos muestra ningún mensaje más que preocupe.
?> Comprobé realmente sucede lo que afirma maycolalvarez , pero con las salvedades que ya pueden observar, desde mi punto de vista puedo decir que es mejor hacerlo de la segunda forma.
Bueno yendo al asunto en efecto, pude comprobar que sucede lo que afirma maycolalvarez
Textualmente
argy comento esto(adicionando a lo que ya habían comentado)
"y además que una variable que se declara dentro de un ciclo termina cuando el ciclo(valga la redundancia ) termina, es decir que la variable existe sólo dentro del ciclo"
maycolalvarez
"No, esto no aplica para php, el ámbito de variables de php sólo se restringe para los bloques de función, no para los ciclos, como resultado toda variable declarada dentro de un ciclo puede accederse fuera de éste, caso contrario de las variables superglobales, que tienen ámbito en todo el script.
En cambio si declaras una variable en el script, en las funciones del mismo script no tendrán acceso a la variable, sino que la re-declararán, a menos que se utilice la palabra global:
Código PHP:
$mivariable="valor principal";
function metodouno(){
echo 'uno:'.$mivariable; //no imprimirá NADA
}
function metododos(){
global $mivariable;
echo 'dos:'.$mivariable; //imprimirá "valor principal"
}
metodouno();
metododos();
esto ocurre porque php no requiere la declaración explícita de variables y no tiene restricción de tipos (sólo PHP5 al paso de parámetros de clases, pero no una restricción de tipos completa)”
argy
"mmmmm??? a ver si te entendi y si me entendiste, una variable declarada dentro de un bucle while, sólo exisitirá dentro del bucle es decir dentro while($i<100){//sólo aqui, pe $var}, ahora me dices que a $var podré acceder desde fuera del while verdad????. como???
por teoría de ámbito de las variables sé que la variable $var existirá sólo dentro de ese bucle while, entonces si me pierdo de algo como imprimo el contenido de esa variable fuera del bucle???, a menos que yo le haya declarado antes del while."
maycolalvarez
“Lo que te explique anteriormente sólo es para PHP, haz la prueba e inventa para que veas, esto no pasaría con C#, ni con java, por eso hay que tener un poco de cuidado con php.
Tu teoría del ámbito es 100% correcta, pero No aplica para php.
y sí, $var tendrá el último valor asignado al terminar el ciclo, prueba y verás, es mejor cuando uno realiza sus propias pruebas ”
pero aquí hay un detalle que cuando configuro el error a E_ALL|E_STRICT
Código PHP:
while($i<10)
{
$j+=$i;
$i++;
}
echo $j;
//aqui de hecho me imprime 45 (CORRECTO).
//PERO
//si no se declara el contador $i y $j, tenemos el siguiente mensaje
//Notice: Undefined variable: i in D:\Web\agp\index.php on line 3
//Notice: Undefined variable: i in D:\Web\agp\index.php on line 5
//Notice: Undefined variable: j in D:\Web\agp\index.php on line 5
//Notice: Undefined variable: i in D:\Web\agp\index.php on line 6
//si no declaramos $j
//Notice: Undefined variable: j in D:\Web\agp\index.php on line 5
?>
Código PHP:
echo '
';
//ahora si declaramos los dos
$k=0;
$m=0;
while($k<10)
{
$m+=$k;
$k++;
}
echo $m;
//imprime el mismo 45 (CORRECTO), pero no nos muestra ningún mensaje más que preocupe.
?> Comprobé realmente sucede lo que afirma maycolalvarez , pero con las salvedades que ya pueden observar, desde mi punto de vista puedo decir que es mejor hacerlo de la segunda forma.
Etiquetas:
ámbito de variables en php,
while
Suscribirse a:
Entradas (Atom)