Load($file); */
$Units = $dom->getElementsByTagName('record');
foreach ($dom->getElementsByTagName('record') as $Unit) {
$UnitID = $Unit->getElementsByTagName('CatalogNumber');
$SourceInstitutionCode = $Unit->getElementsByTagName('InstitutionCode');
$SourceName = $Unit->getElementsByTagName('CollectionCode');
// echo "Unit ID: " . $UnitID->item(0)->nodeValue . "
";
// echo "Source Institution: " . $SourceInstitutionCode->item(0)->nodeValue . "
";
// echo "Source Collection: " . $SourceName->item(0)->nodeValue . "
";
$sqlUnitID = $UnitID->item(0)->nodeValue;
$sqlSourceInstitutionCode = $SourceInstitutionCode->item(0)->nodeValue;
$sqlSourceName = $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');
$LocalityText = $Unit->getElementsByTagName('Locality');
$Country = $Unit->getElementsByTagName('Country');
$StateProvince = $Unit->getElementsByTagName('StateProvince');
$County = $Unit->getElementsByTagName('County');
$LongitudeDecimal = $Unit->getElementsByTagName('Longitude');
$LatitudeDecimal = $Unit->getElementsByTagName('Latitude');
$Altitude = $Unit->getElementsByTagName('Altitude');
/* echo "Date: " . $GatheringDay->item(0)->nodeValue . ".";
echo $GatheringMonth->item(0)->nodeValue . ".";
echo $GatheringYear->item(0)->nodeValue . "
";
echo "Person: " . $GatheringAgents->item(0)->nodeValue . "
";
echo "Locality: " . $StateProvince->item(0)->nodeValue . " ";
echo $County->item(0)->nodeValue . " ";
echo $LocalityText->item(0)->nodeValue . "
";
echo "Country: " . $Country->item(0)->nodeValue . "
";
echo "Continent or Ocean: " . $ContinentOrOcean->item(0)->nodeValue . "
";
echo "Longitude: " . $LongitudeDecimal->item(0)->nodeValue . "
";
echo "Latitude: " . $LatitudeDecimal->item(0)->nodeValue . "
";
echo "Altitude: " . $Altitude->item(0)->nodeValue . "
";*/
$sqlGatheringDate = $GatheringDay->item(0)->nodeValue;
if ($GatheringDay) {
$sqlGatheringDate .= "."; }
$sqlGatheringDate .= $GatheringMonth->item(0)->nodeValue;
if ($GatheringMonth) {
$sqlGatheringDate .= "."; }
$sqlGatheringDate .= $GatheringYear->item(0)->nodeValue;
$sqlPersonName = $GatheringAgents->item(0)->nodeValue;
$sqlLocalityText = $StateProvince->item(0)->nodeValue;
if ($StateProvince) {
$sqlLocalityText .= " "; }
$sqlLocalityText .= $County->item(0)->nodeValue;
if ($County) {
$sqlLocalityText .= " "; }
$sqlLocalityText .= $LocalityText->item(0)->nodeValue;
$sqlLongitudeDecimal = $LongitudeDecimal->item(0)->nodeValue;
$sqlLatitudeDecimal = $LatitudeDecimal->item(0)->nodeValue;
$sqlAltitude = $Altitude->item(0)->nodeValue;
$sqlContinentOrOcean = $ContinentOrOcean->item(0)->nodeValue;
$sqlCountryName = $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($HigherTaxon[0]) {
echo $HigherTaxon[0] . "(" . $HigherTaxonRank[0] . ")
";
}
if($HigherTaxon[1]) {
echo $HigherTaxon[1] . "(" . $HigherTaxonRank[1] . ")
";
}
if($HigherTaxon[2]) {
echo $HigherTaxon[2] . "(" . $HigherTaxonRank[2] . ")
";
}
if($HigherTaxon[3]) {
echo $HigherTaxon[3] . "(" . $HigherTaxonRank[3] . ")
";
}
if($HigherTaxon[4]) {
echo $HigherTaxon[4] . "(" . $HigherTaxonRank[4] . ")
";
}*/
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');
/*
InfraspecificRank = ssp., var., forma
InfraspecificEpithet = Subspecies
IdentificationQualifier = cf., aff.
ScientificNameAuthor = Autor */
// 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 = $NameAuthorYearString->item(0)->nodeValue;
}
?>