/** * parseIdentification function * * @param DOMElement $identification * @param boolean $current * @return array */ private function parseIdentification($identification, $current) { $row = array(); if ($current) { $root = 'Unit/Identifications/Identification[PreferredFlag="true"]/'; $meta = 'core'; } else { $root = 'Unit/Identifications/Identification[PreferredFlag="false"]/'; $meta = 'extension'; } $identificationid = $identification->getElementsByTagName('identificationID'); if ($identificationid->length) { $row[] = array('column' => "dwc:identificationID[{$meta}]", 'value' => $identificationid->item(0)->nodeValue); } $sciname = $identification->getElementsbyTagName('FullScientificNameString'); if ($sciname->length) { $row[] = array('column' => $root . 'Result/TaxonIdentified/ScientificName/FullScientificNameString', 'value' => $sciname->item(0)->nodeValue); } $atomisedname = $identification->getElementsByTagName('Botanical'); if ($atomisedname->length) { $parts = $atomisedname->item(0)->getElementsByTagName('*'); foreach ($parts as $part) { $tagname = $part->tagName; if (strpos($tagname, ':')) { $tagname = substr($tagname, strpos($tagname, ':') + 1); } $row[] = array('column' => $root . 'Result/TaxonIdentified/ScientificName/NameAtomised/Botanical/' . $tagname, 'value' => $part->nodeValue); } } $taxonrank = $identification->getElementsByTagName('taxonRank'); if ($taxonrank->length) { $row[] = array('column' => "dwc:taxonRank[{$meta}]", 'value' => $taxonrank->item(0)->nodeValue); } else { $taxonrank = $identification->getElementsByTagName('Rank'); if ($taxonrank->length) { $row[] = array('column' => "dwc:taxonRank[{$meta}]", 'value' => $taxonrank->item(0)->nodeValue); } } $identificationqualifier = $this->IdentificationQualifier($identification); if ($identificationqualifier) { $row[] = array('column' => "dwc:identificationQualifier[{$meta}]", 'value' => $identificationqualifier[0]); $row[] = array('column' => "abcd:IdentificationQualifier[{$meta}]", 'value' => $identificationqualifier[1]); $row[] = array('column' => "abcd:InsertionPoint[{$meta}]", 'value' => $identificationqualifier[2]); } $nameaddendum = $identification->getElementsByTagName('NameAddendum'); if ($nameaddendum->length) { $row[] = array('column' => $root . 'Result/TaxonIdentified/ScientificName/NameAddendum', 'value' => $nameaddendum->item(0)->nodeValue); } $identifier = $identification->getElementsByTagName('IdentifierRole'); if ($identifier->length) { $row[] = array('column' => $root . 'Identifiers/IdentifierRole', 'value' => $identifier->item(0)->nodeValue); } $identifier = $identification->getElementsByTagName('IdentifiersText'); if ($identifier->length) { $row[] = array('column' => $root . 'Identifiers/IdentifiersText', 'value' => $identifier->item(0)->nodeValue); } $identificationdate = $identification->getElementsByTagName('ISODateTimeBegin'); if ($identificationdate->length) { $row[] = array('column' => $root . 'Date/ISODateTimeBegin', 'value' => $identificationdate->item(0)->nodeValue); } $identificationnotes = $identification->getElementsByTagName('Notes'); if ($identificationnotes->length) { $row[] = array('column' => $root . 'Notes', 'value' => $identificationnotes->item(0)->nodeValue); } // Merge higher taxa onto the array $row = array_merge($row, $this->HigherTaxa2($identification, $current)); // Push scientific name authorship onto array //$row = array_merge($row, $this->ScientificNameAuthorship($identification)); if ($scientificnameauthorship = $this->ScientificNameAuthorship($identification)) { $row[] = array('column' => "dwc:scientificNameAuthorship[{$meta}]", 'value' => $scientificnameauthorship); } return $row; }