get_elements_by_tagname('Unit'); foreach ($Units as $Unit) { $UnitID = $Unit->get_elements_by_tagname('UnitID'); $SourceInstitutionCode = $Unit->get_elements_by_tagname('SourceInstitutionID'); $SourceName = $Unit->get_elements_by_tagname('SourceID'); $GatheringNo = $Unit->get_elements_by_tagname('CollectorsFieldNumber'); // echo "Unit ID: " . $UnitID[0]->get_content() . "
"; // echo "Source Institution: " . $SourceInstitutionCode[0]->get_content() . "
"; // echo "Source Collection: " . $SourceName[0]->get_content() . "
"; $sqlUnitID = addslashes(utf8_decode($UnitID[0]->get_content())); $sqlSourceInstitutionCode = addslashes(utf8_decode($SourceInstitutionCode[0]->get_content())); $sqlSourceName = addslashes(utf8_decode($SourceName[0]->get_content())); $sqlGatheringNo = addslashes(utf8_decode($GatheringNo[0]->get_content())); /*----------------------------GATHERING--------------------------------------------------------- */ $Gatherings = $Unit->get_elements_by_tagname('Gathering'); foreach ($Gatherings as $Gathering) { $GatheringDate = $Gathering->get_elements_by_tagname('DateTime'); $GatheringAgents = $Gathering->get_elements_by_tagname('Agents'); $LocalityText = $Gathering->get_elements_by_tagname('LocalityText'); $Country = $Gathering->get_elements_by_tagname('Country'); $NamedArea = $Gathering->get_elements_by_tagname('NamedArea'); //if (empty($Country)) $AreaName = $Gathering->get_elements_by_tagname('AreaName'); $NearNamedPlaces = $Gathering->get_elements_by_tagname('NearNamedPlaces'); //if (empty($Country)) $Altitude = $Gathering->get_elements_by_tagname('Altitude'); $LongitudeDecimal = $Gathering->get_elements_by_tagname('LongitudeDecimal'); $LatitudeDecimal = $Gathering->get_elements_by_tagname('LatitudeDecimal'); $SiteCoordinates = $Gathering->get_elements_by_tagname('SiteCoordinatesSets'); //if (empty($LongitudeDecimal & LatitudeDecimal)) foreach ($Altitude as $AltitudeDetail) { $AltitudeLowerValue = $AltitudeDetail->get_elements_by_tagname('LowerValue'); $AltitudeUpperValue = $AltitudeDetail->get_elements_by_tagname('UpperValue'); if(!empty($AltitudeLowerValue)) {$sqlAltitude = $AltitudeLowerValue[0]->get_content();} if(!empty($AltitudeUpperValue)) { $sqlAltitude .= $AltitudeUpperValue[0]->get_content();} } foreach ($GatheringDate as $DateTime) { $GatheringDateText = $DateTime->get_elements_by_tagname('DateText'); $GatheringISODateTimeBegin = $DateTime->get_elements_by_tagname('ISODateTimeBegin'); $GatheringDayNumberBegin = $DateTime->get_elements_by_tagname('DayNumberBegin'); $GatheringTimeOfDayBegin = $DateTime->get_elements_by_tagname('ISOTimeOfDayBegin'); $GatheringISODateTimeEnd = $DateTime->get_elements_by_tagname('ISODateTimeEnd'); $GatheringDayNumberEnd = $DateTime->get_elements_by_tagname('DayNumberEnd'); $GatheringTimeOfDayEnd = $DateTime->get_elements_by_tagname('TimeOfDayEnd'); if(empty($GatheringDateText)) { if($GatheringDate) { // echo "Date2: " . $GatheringDate[0]->get_content() . "
"; //if (empty($GatheringDate)) $sqlGatheringDate = addslashes($GatheringDate[0]->get_content()); }} else { // echo "Date: " . $GatheringDateText[0]->get_content() . "
"; $sqlGatheringDate = addslashes($GatheringDateText[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('GatheringAgent'); $AgentText = $GatheringAgent->get_elements_by_tagname('GatheringAgentsText'); //if (empty($GatheringAgent) if(empty($PersonName)) { if($AgentText) { // echo "Person: " . $PersonName[0]->get_content() . "
"; $sqlPersonName = addslashes(utf8_decode($AgentText[0]->get_content())); } } else { $sqlPersonName = addslashes(utf8_decode($PersonName[0]->get_content())); } } if($LocalityText) { // echo "Locality: " . $LocalityText[0]->get_content() . "
"; $sqlLocalityText = addslashes(utf8_decode($LocalityText[0]->get_content())); } foreach ($Country as $Countries) { $CountryName = $Countries->get_elements_by_tagname('Name'); $ISO2 = $Countries->get_elements_by_tagname('ISO3166Code'); 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($NearNamedPlaces) { // echo "NearNamedPlaces: " . $NearNamedPlaces[0]->get_content() . "
"; $sqlGatheringOther = addslashes($NearNamedPlaces[0]->get_content());} } if($AreaName) { $sqlNamedAreas = addslashes($AreaName[0]->get_content()); } if($sqlNamedAreas = 'Africa' or $sqlNamedAreas = 'Asia' or $sqlNamedAreas = 'Australia' or $sqlNamedAreas = 'Australia and Oceania' or $sqlNamedAreas = 'Europe' or $sqlNamedAreas = 'Middle America' or $sqlNamedAreas = 'South America' or $sqlNamedAreas = 'Middle America' or $sqlNamedAreas = 'Middle and South America' or $sqlNamedAreas = 'North America' or $sqlNamedAreas = ' Atlantic Ocean' or $sqlNamedAreas = 'Arctic Ocean' or $sqlNamedAreas = 'Indian Ocean' or $sqlNamedAreas = 'Pacific Ocean' or $sqlNamedAreas = 'Southern Ocean' or $sqlNamedAreas = 'Landlocked Sea') { $sqlContinentOrOcean = addslashes($AreaName[0]->get_content()); } else { if($NamedArea) { // echo "NamedAreas: " . $NamedAreas[0]->get_content() . "
"; $sqlGatheringOther = addslashes($NamedArea[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(); } } //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'); $Preferred = $Identification->get_elements_by_tagname('PreferredFlag'); foreach ($TaxaIdentified as $TaxonIdentified) { $NameAuthorYearString = $TaxonIdentified->get_elements_by_tagname('FullScientificNameString'); // Name, Author, Year $HigherTaxa = $TaxonIdentified->get_elements_by_tagname('HigherTaxon'); $ScientificNames = $TaxonIdentified->get_elements_by_tagname('ScientificName'); if($NameAuthorYearString) { // echo "Name All: " . $NameAuthorYearString[0]->get_content() . "
"; $sqlNameAuthorYearString[] = addslashes(utf8_decode($NameAuthorYearString[0]->get_content())); } if($Preferred) { // echo "Preferred: " . $Preferred[0]->get_content() . "
"; $sqlPreferredIdentificationFlag[] = $Preferred[0]->get_content(); } foreach ($HigherTaxa as $index => $HigherTaxon1) { // more than one HigherTaxon per Identification possible $HigherTaxon = $HigherTaxon1->get_elements_by_tagname('HigherTaxonName'); $TaxonRank = $HigherTaxon1->get_elements_by_tagname('HigherTaxonRank'); if($HigherTaxon) { // echo "Higher Taxon: " .$HigherTaxon[0]->get_content()." (".$TaxonRank[0]->get_content().")
"; $sqlHigherTaxon[] = $HigherTaxon[0]->get_content(); } if($TaxonRank) { $sqlHigherTaxonRank[] = $TaxonRank[0]->get_content(); } } //foreach $HugherTaxa foreach ($ScientificNames as $ScientificName) { // $ScientificNamesAtomized = $ScientificName->get_elements_by_tagname('NameAtomised'); // foreach ($ScientificNamesAtomized as $ScientificNameAtomized) { $Bacteria = $ScientificName->get_elements_by_tagname('Bacterial'); $Botany = $ScientificName->get_elements_by_tagname('Botanical'); $Zoology = $ScientificName->get_elements_by_tagname('Zoological'); $Virology = $ScientificName->get_elements_by_tagname('Viral'); if($Bacteria) { foreach ($Bacteria as $Bacterical) { $GenusBac = $Bacterical->get_elements_by_tagname('GenusOrMonomial'); $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('GenusOrMonomial'); $FirstEpithet = $Botanical->get_elements_by_tagname('FirstEpithet'); $SecondEpithet = $Botanical->get_elements_by_tagname('InfraspecificEpithet'); $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($SubgenusBot) { // 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('GenusOrMonomial'); $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->nodeValue . "
"; //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('GenusOrMonomial'); 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 $ScientificNames } //foreach $TaxaIdentified } //foreach $Identifications /*----------------------------------------MULTI MEDIA OBJECTS -----------------------------*/ $MultiMediaObjects = $Unit->get_elements_by_tagname('MultiMediaObject'); foreach ($MultiMediaObjects as $IndexMultiMediaObjects => $MultiMediaObject) { // more than one Identification possible $FileURI = $MultiMediaObject->get_elements_by_tagname('FileURI'); $ProductURI = $MultiMediaObject->get_elements_by_tagname('ProductURI'); if($FileURI) { $sqlFileURI[] = $FileURI[0]->get_content(); } if($ProductURI) { $sqlProductURI[] = $ProductURI[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 ?>