* @author Gabriele Droege, DNA Bank Network * @version 2.0 * @package Input * @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org
The contents of this file are subject to the Mozilla Public License Version 1.1 * @filesource * @license http://www.mozilla.org/MPL/ MPL */ $Units = $dom->getElementsByTagName('record'); foreach ($Units as $Unit) { $UnitID1 = $Unit->getElementsByTagName('CatalogNumberText'); $UnitID2 = $Unit->getElementsByTagName('CatalogNumber'); $UnitID1node = $UnitID1->item(0)->nodeValue; $UnitID2node = $UnitID2->item(0)->nodeValue; if(empty($UnitID1node)) { $UnitIDfinal = $UnitID2node; } else { $UnitIDfinal = $UnitID1node;} $SourceInstitutionCode = $Unit->getElementsByTagName('InstitutionCode'); $SourceName = $Unit->getElementsByTagName('CollectionCode'); // echo "Unit ID: " . $UnitIDfinal. "
"; // echo "Source Institution: " . $SourceInstitutionCode->item(0)->nodeValue . "
"; // echo "Source Collection: " . $SourceName->item(0)->nodeValue . "
"; $sqlUnitID = addslashes($UnitIDfinal); $sqlSourceInstitutionCode = addslashes($SourceInstitutionCode->item(0)->nodeValue); $sqlSourceName = addslashes($SourceName->item(0)->nodeValue); /*----------------------------GATHERING--------------------------------------------------------- */ $GatheringYear = $Unit->getElementsByTagName('YearCollected'); $GatheringMonth = $Unit->getElementsByTagName('MonthCollected'); $GatheringDay = $Unit->getElementsByTagName('DayCollected'); $GatheringAgents = $Unit->getElementsByTagName('Collector'); $ContinentOrOcean = $Unit->getElementsByTagName('ContinentOcean'); $Locality = $Unit->getElementsByTagName('Locality'); $Country = $Unit->getElementsByTagName('Country'); $StateProvince = $Unit->getElementsByTagName('StateProvince'); $County = $Unit->getElementsByTagName('County'); $Longitude = $Unit->getElementsByTagName('Longitude'); $Latitude = $Unit->getElementsByTagName('Latitude'); $Altitude = $Unit->getElementsByTagName('Altitude'); $sqlCollectionDate = $GatheringDay->item(0)->nodeValue; if ($GatheringDay) { $sqlCollectionDate .= "."; } $sqlCollectionDate .= $GatheringMonth->item(0)->nodeValue; if ($GatheringMonth) { $sqlCollectionDate .= "."; } $sqlCollectionDate .= $GatheringYear->item(0)->nodeValue; $sqlPersonName = addslashes($GatheringAgents->item(0)->nodeValue); $sqlLocality = addslashes($StateProvince->item(0)->nodeValue); if ($StateProvince) { $sqlLocality .= " "; } $sqlLocality .= addslashes($County->item(0)->nodeValue); if ($County) { $sqlLocality .= " "; } $sqlLocality .= addslashes($Locality->item(0)->nodeValue); $sqlLongitude = $Longitude->item(0)->nodeValue; $sqlLatitude = $Latitude->item(0)->nodeValue; $sqlAltitude = addslashes($Altitude->item(0)->nodeValue); $sqlContinentOrOcean = addslashes($ContinentOrOcean->item(0)->nodeValue); $sqlCountryName = addslashes($Country->item(0)->nodeValue); /*----------------------------IDENTIFICATIONS--------------------------------------------------------- */ $NameAuthorYearString = $Unit->getElementsByTagName('ScientificName'); // Name, Author, Year $Kingdom = $Unit->getElementsByTagName('Kingdom'); $Phylum = $Unit->getElementsByTagName('Phylum'); $Class = $Unit->getElementsByTagName('Class'); $Order = $Unit->getElementsByTagName('Order'); $Family = $Unit->getElementsByTagName('Family'); $HigherTaxon = array ($Kingdom->item(0)->nodeValue, $Phylum->item(0)->nodeValue, $Class->item(0)->nodeValue, $Order->item(0)->nodeValue, $Family->item(0)->nodeValue); $HigherTaxonRank = array ("Kingdom", "Phylum", "Class", "Order", "Family"); $sqlHigherTaxon = array ($Kingdom->item(0)->nodeValue, $Phylum->item(0)->nodeValue, $Class->item(0)->nodeValue, $Order->item(0)->nodeValue, $Family->item(0)->nodeValue); if($sqlHigherTaxon[0]) { $sqlHigherTaxonRank[0] = $HigherTaxonRank[0]; } if($sqlHigherTaxon[1]) { $sqlHigherTaxonRank[1] = $HigherTaxonRank[1]; } if($sqlHigherTaxon[2]) { $sqlHigherTaxonRank[2] = $HigherTaxonRank[2]; } if($sqlHigherTaxon[3]) { $sqlHigherTaxonRank[3] = $HigherTaxonRank[3]; } if($sqlHigherTaxon[4]) { $sqlHigherTaxonRank[4] = $HigherTaxonRank[4]; } $Genus = $Unit->getElementsByTagName('Genus'); $Subgenus = $Unit->getElementsByTagName('Subgenus'); $SpeciesEpithet = $Unit->getElementsByTagName('Species'); $SubspeciesEpithet = $Unit->getElementsByTagName('Subspecies'); $Rank = $Unit->getElementsByTagName('InfraspecificRank'); // echo "Genus: " . $Genus->item(0)->nodeValue . "
"; $sqlGenus = $Genus->item(0)->nodeValue; // echo "Subgenus: " . $Subgenus->item(0)->nodeValue . "
"; $sqlSubgenus = $Subgenus->item(0)->nodeValue; // echo "Spec.Epi: " . $SpeciesEpithet->item(0)->nodeValue . "
"; $sqlFirstEpithet = $SpeciesEpithet->item(0)->nodeValue; // echo "Rank: " . $Rank->item(0)->nodeValue . "
"; $sqlRank = $Rank->item(0)->nodeValue; // echo "SspEpi: " . $SubspeciesEpithet->item(0)->nodeValue . "
"; $sqlSecondEpithet = $SubspeciesEpithet->item(0)->nodeValue; // echo "Name All: " . $NameAuthorYearString->item(0)->nodeValue . "
"; $sqlNameAuthorYearString = addslashes($NameAuthorYearString->item(0)->nodeValue); /*----------------------------------------MULTI MEDIA OBJECTS -----------------------------*/ $MultiMediaObjects = $Unit->getElementsByTagName('ImageURL'); $sqlFileURI = $MultiMediaObjects->item(0)->nodeValue; // $TypeStatus = $TypeDesignation->getElementsByTagName('TypeStatus'); // $sqlTypeStatus = $TypeStatus->item(0)->nodeValue; } ?>