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