get_elements_by_tagname('DataSet'); foreach ($Datasets as $Dataset) { $SourceInstitutionCode = $Dataset->get_elements_by_tagname('SourceInstitutionCode'); $SourceName = $Dataset->get_elements_by_tagname('SourceName'); // echo "Source Institution: " . $sqlSourceInstitutionCode . "
"; // echo "Source Collection: " . $SourceName[0]->get_content() . "
"; $sqlSourceInstitutionCode = addslashes(utf8_decode($SourceInstitutionCode[0]->get_content())); $sqlSourceName = addslashes(utf8_decode($SourceName[0]->get_content())); $Units = $Dataset->get_elements_by_tagname('Unit'); foreach ($Units as $Unit) { $UnitID = $Unit->get_elements_by_tagname('UnitID'); $GatheringNo = $Dataset->get_elements_by_tagname('CollectorsFieldNumber'); // echo "Unit ID: " . $UnitID[0]->get_content() . "
"; $sqlUnitID = $UnitID[0]->get_content(); $sqlGatheringNo = $GatheringNo[0]->get_content(); /*----------------------------GATHERING---------------------------------------------------------*/ $Gatherings = $Unit->get_elements_by_tagname('Gathering'); foreach ($Gatherings as $Gathering) { $GatheringDate = $Gathering->get_elements_by_tagname('DateText'); $GatheringDateAll = $Gathering->get_elements_by_tagname('GatheringDateTime'); //if (empty($GatheringDate)) $GatheringISODateTimeBegin = $Gathering->get_elements_by_tagname('ISODateTimeBegin'); $GatheringDayNumberBegin = $Gathering->get_elements_by_tagname('DayNumberBegin'); $GatheringTimeOfDayBegin = $Gathering->get_elements_by_tagname('ISOTimeOfDayBegin'); $GatheringISODateTimeEnd = $Gathering->get_elements_by_tagname('ISODateTimeEnd'); $GatheringDayNumberEnd = $Gathering->get_elements_by_tagname('DayNumberEnd'); $GatheringTimeOfDayEnd = $Gathering->get_elements_by_tagname('TimeOfDayEnd'); $GatheringAgents = $Gathering->get_elements_by_tagname('GatheringAgent'); $GatheringSites = $Gathering->get_elements_by_tagname('GatheringSite'); if(empty($GatheringDate)) { if($GatheringDateAll) { // echo "Date2: " . $GatheringDateAll[0]->get_content() . "
"; //if (empty($GatheringDate)) $sqlGatheringDate = addslashes($GatheringDateAll[0]->get_content()); }} else { // echo "Date: " . $GatheringDate[0]->get_content() . "
"; if($GatheringDate) { $sqlGatheringDate = addslashes($GatheringDate[0]->get_content()); }} if($GatheringISODateTimeBegin) { $sqlGatheringDate .= " " . $GatheringISODateTimeBegin[0]->get_content(); } if($GatheringDayNumberBegin) { $sqlGatheringDate .= " " . $GatheringDayNumberBegin[0]->get_content(); } if($GatheringTimeOfDayBegin) { $sqlGatheringDate .= " " . $GatheringTimeOfDayBegin[0]->get_content(); } if($GatheringISODateTimeEnd) { $sqlGatheringDate .= " " . $GatheringISODateTimeEnd[0]->get_content(); } if($GatheringDayNumberEnd) { $sqlGatheringDate .= " " . $GatheringDayNumberEnd[0]->get_content(); } if($GatheringTimeOfDayEnd) { $sqlGatheringDate .= " " . $GatheringTimeOfDayEnd[0]->get_content(); } foreach ($GatheringAgents as $GatheringAgent) { $PersonName = $GatheringAgent->get_elements_by_tagname('PersonName'); $AgentText = $GatheringAgent->get_elements_by_tagname('AgentText'); //if (empty($GatheringAgent) if(empty($GatheringAgent)) { if($AgentText) { // echo "Person2: " . $AgentText[0]->get_content() . "
"; $sqlPersonName = addslashes($AgentText[0]->get_content()); }} else { if($PersonName) { // echo "Person: " . $PersonName[0]->get_content() . "
"; $sqlPersonName = addslashes($PersonName[0]->get_content()); }} } foreach ($GatheringSites as $GatheringSite) { $LocalityText = $GatheringSite->get_elements_by_tagname('LocalityText'); $ContinentOrOcean = $GatheringSite->get_elements_by_tagname('ContinentOrOcean'); $CountryName = $GatheringSite->get_elements_by_tagname('CountryName'); $Country = $GatheringSite->get_elements_by_tagname('Country'); //if (empty($CountryName)) $ISO2 = $GatheringSite->get_elements_by_tagname('ISO2Letter'); $NamedArea = $GatheringSite->get_elements_by_tagname('NamedArea'); //if (empty($Country)) $NearNamedPlaces = $GatheringSite->get_elements_by_tagname('NearNamedPlaces'); //if (empty($Country)) $LongitudeDecimal = $GatheringSite->get_elements_by_tagname('LongitudeDecimal'); $LatitudeDecimal = $GatheringSite->get_elements_by_tagname('LatitudeDecimal'); $SiteCoordinates = $GatheringSite->get_elements_by_tagname('SiteCoordinates'); //if (empty($LongitudeDecimal & LatitudeDecimal)) $Altitude = $GatheringSite->get_elements_by_tagname('Altitude'); if($LocalityText) { // echo "Locality: " . $LocalityText[0]->get_content() . "
"; $sqlLocalityText = addslashes($LocalityText[0]->get_content()); } if($ContinentOrOcean) { // echo "Continent: " . $ContinentOrOcean[0]->get_content() . "
"; $sqlContinentOrOcean = addslashes($ContinentOrOcean[0]->get_content()); } if(empty($CountryName)) { if($Country) { // echo "Country2: " . $Country[0]->get_content() . "
"; $sqlCountryName = addslashes($Country[0]->get_content()); }} else { // echo "Country: " . $CountryName[0]->get_content() . "
"; $sqlCountryName = addslashes($CountryName[0]->get_content()); } if($ISO2) { // echo "ISO2: " . $ISO2[0]->get_content() . "
"; $sqlISO2 = addslashes($ISO2[0]->get_content()); } if(empty($NamedArea)) { if($NearNamesPlaces) { // echo "NearNamedPlaces: " . $NearNamedPlaces[0]->get_content() . "
"; $sqlGatheringOther = addslashes($NearNamedPlaces[0]->get_content()); } } else { if(!empty($GatheringOther)) { // echo "NamedAreas: " . $NamedAreas[0]->get_content() . "
"; $sqlGatheringOther = addslashes($NamedAreas[0]->get_content()); } } if($LongitudeDecimal) { // echo "Longitude: " . $LongitudeDecimal[0]->get_content() . "
"; $sqlLongitudeDecimal = $LongitudeDecimal[0]->get_content(); } if($LatitudeDecimal) { // echo "Latitude: " . $LatitudeDecimal[0]->get_content() . "
"; $sqlLatitudeDecimal = $LatitudeDecimal[0]->get_content(); } // echo "Coordinates: " . $SiteCoordinates[0]->get_content() . "
"; if($Altitude) { // echo "Altitude: " . $Altitude[0]->get_content() . "
"; $sqlAltitude = addslashes($Altitude[0]->get_content()); } } // foreach $GatheringSites } //foreach $Gatherings /*----------------------------IDENTIFICATIONS---------------------------------------------------------*/ $Identifications = $Unit->get_elements_by_tagname('Identification'); foreach ($Identifications as $IndexIdentification => $Identification) { // more than one Identification possible // $TaxaIdentified = $Identification->get_elements_by_tagname('TaxonIdentified'); // foreach ($TaxaIdentified as $TaxonIdentified) { $NameAuthorYearString = $Identification->get_elements_by_tagname('NameAuthorYearString'); // Name, Author, Year $ScientificNamesAtomized = $Identification->get_elements_by_tagname('ScientificNameAtomized'); $HigherTaxa = $Identification->get_elements_by_tagname('HigherTaxon'); if($NameAuthorYearString) { // echo "Name All: " . $NameAuthorYearString[0]->get_content() . "
"; $sqlNameAuthorYearString[] = addslashes($NameAuthorYearString[0]->get_content()); } if($Identification) { // echo "Preferred: " . $Identification->get_attribute('PreferredIdentificationFlag') . "
"; $sqlPreferredIdentificationFlag[] = $Identification->get_attribute('PreferredIdentificationFlag'); } foreach ($HigherTaxa as $index => $HigherTaxon) { // more than one HigherTaxon per Identification possible if($HigherTaxon) { // echo "Higher Taxon: " .$HigherTaxon." (".$HigherTaxon->get_attribute('TaxonRank').")
"; $sqlHigherTaxon[] = $HigherTaxon; $sqlHigherTaxonRank[] = $HigherTaxon->get_attribute('TaxonRank'); } } //foreach $HugherTaxa foreach ($ScientificNamesAtomized as $ScientificNameAtomized) { $Bacteria = $ScientificNameAtomized->get_elements_by_tagname('Bacterial'); $Botany = $ScientificNameAtomized->get_elements_by_tagname('Botanical'); $Zoology = $ScientificNameAtomized->get_elements_by_tagname('Zoological'); $Virology = $ScientificNameAtomized->get_elements_by_tagname('Viral'); if($Bacteria) { foreach ($Bacteria as $Bacterical) { $GenusBac = $Bacterical->get_elements_by_tagname('Genus'); $SubgenusBac = $Bacterical->get_elements_by_tagname('Subgenus'); $SpeciesEpithetBac = $Bacterical->get_elements_by_tagname('SpeciesEpithet'); $SubspeciesEpithetBac = $Bacterical->get_elements_by_tagname('SubspeciesEpithet'); if($GenusBac) { // echo "Genus: " . $GenusBac[0]->get_content() . "
"; $sqlGenus[] = $GenusBac[0]->get_content(); } if($SubgenusBac) { // echo "Subgenus: " . $SubgenusBac[0]->get_content() . "
"; $sqlSubgenus[] = $SubgenusBac[0]->get_content(); } if($SpeciesEpithetBac) { // echo "Spec.Epi: " . $SpeciesEpithetBac[0]->get_content() . "
"; $sqlFirstEpithet[] = $SpeciesEpithetBac[0]->get_content(); } if($SubspeciesEpithetBac) { // echo "SspEpi: " . $SubspeciesEpithetBac[0]->get_content() . "
"; $sqlSecondEpithet[] = $SubspeciesEpithetBac[0]->get_content(); } if(empty($sqlGenus) and empty($sqlSubgenus) and empty($sqlFirstEpithet) and empty($sqlSubspecies)) { // echo "Bacteria_All: " . $Bacteria[0]->get_content() . "
"; //if (empty -> $GenusBac, $SubgenusBac, $SpeciesEpithetBac, $SubspeciesEpithetBac) $sqlName_All[] = $Bacteria[0]->get_content(); } } //foreach $Bacteria } //if($Bacteria) if($Botany) { foreach ($Botany as $Botanical) { $GenusBot = $Botanical->get_elements_by_tagname('Genus'); $FirstEpithet = $Botanical->get_elements_by_tagname('FirstEpithet'); $SecondEpithet = $Botanical->get_elements_by_tagname('SecondEpithet'); $Rank = $Botanical->get_elements_by_tagname('Rank'); $HybridFlag = $Botanical->get_elements_by_tagname('HybridFlag'); if($GenusBot) { // echo "Genus: " . $GenusBot[0]->get_content() . "
"; $sqlGenus[] = $GenusBot[0]->get_content(); } if($FirstEpithet) { // echo "Spec.Epi: " . $FirstEpithet[0]->get_content() . "
"; $sqlFirstEpithet[] = $FirstEpithet[0]->get_content(); } if($Rank) { // echo "Rank: " . $Rank[0]->get_content() . "
"; $sqlRank[] = $Rank[0]->get_content(); } if($SecondEpithet) { // echo "Sec.Epi: " . $SecondEpithet[0]->get_content() . "
"; $sqlSecondEpithet[] = $SecondEpithet[0]->get_content(); } if($HybridFlag) { // echo "Hybrid: " . $HybridFlag[0]->get_content() . "
"; $sqlHybridFlag[] = $HybridFlag[0]->get_content(); } if(empty($sqlGenus) and empty($sqlFirstEpithet) and empty($sqlRank) and empty($sqlSecondEpithet)) { // echo "Botany_All: " . $Botany[0]->get_content() . "
"; //if (empty -> $GenusBot, $FirstEpithet, $SecondEpithet, $Rank, $HybridFlag) $sqlName_All[] = $Botany[0]->get_content(); } } //foreach $Botany } //if($Botany) if($Zoology) { foreach ($Zoology as $Zoological => $Zoo) { $GenusZoo = $Zoo->get_elements_by_tagname('Genus'); $SubgenusZoo = $Zoo->get_elements_by_tagname('Subgenus'); $SpeciesEpithetZoo = $Zoo->get_elements_by_tagname('SpeciesEpithet'); $SubspeciesEpithetZoo = $Zoo->get_elements_by_tagname('SubspeciesEpithet'); if($GenusZoo) { // echo "Genus: " .$GenusZoo[0]->get_content()."
"; $sqlGenus[] = $GenusZoo[0]->get_content(); } if($SubgenusZoo) { // echo "Subgenus: " . $SubgenusZoo[0]->get_content() . "
"; $sqlSubgenus[] = $SubgenusZoo[0]->get_content(); } if($SpeciesEpithetZoo) { // echo "Spec.Epi: " . $SpeciesEpithetZoo[0]->get_content() . "
"; $sqlFirstEpithet[] = $SpeciesEpithetZoo[0]->get_content(); } if($SubspeciesEpithetZoo) { // echo "SspEpi: " . $SubspeciesEpithetZoo[0]->get_content() . "
"; $sqlSecondEpithet[] = $SubspeciesEpithetZoo[0]->get_content(); } if($sqlSecondEpithet) { $sqlRank = "ssp."; } if(empty($sqlGenus) and empty($sqlSubgenus) and empty($sqlFirstEpithet) and empty($sqlSecondEpithet)) { // echo "Zoology_All: " . $Zoo . "
"; //if (empty -> $GenusZ, $SubgenusZ, $SpeciesEpithetZ, $SubspeciesEpithetZ) $sqlName_All[] = $Zoology[0]->get_content(); } } //foreach $Zoology } //if($Zoology) if($Virology) { foreach ($Virology as $Viral) { $GenusV = $Viral->get_elements_by_tagname('Genus'); if($GenusV) { // echo "Genus: " . $GenusV[0]->get_content() . "
"; $sqlGenus[] = $GenusV[0]->get_content(); } if(empty($sqlGenus)) { // echo "Virology_All: " . $Virology[0]->get_content() . "
"; $sqlName_All[] = $Virology[0]->get_content(); } } //foreach $Virology } //if($Virology) } //foreach $ScientificNamesAtomized // } //foreach $TaxaIdentified } //foreach $Identifications /*----------------------------------------MULTI MEDIA OBJECTS -----------------------------*/ $MultiMediaObjects = $Unit->get_elements_by_tagname('UnitDigitalImage'); foreach ($MultiMediaObjects as $IndexMultiMediaObjects => $MultiMediaObject) { // more than one Identification possible $FileURI = $MultiMediaObject->get_elements_by_tagname('ImageURI'); if($FileURI) { $sqlFileURI[] = $FileURI[0]->get_content(); } } // foreach $MultiMediaObjects $TypeDesignations = $Unit->get_elements_by_tagname('NomenclaturalTypeDesignation'); foreach ($TypeDesignations as $TypeDesignation) { $TypeStatus = $TypeDesignation->get_elements_by_tagname('TypeStatus'); $sqlTypeStatus = $TypeStatus[0]->get_content(); } } //foreach $Units } //foreach $Datasets ?>