本文整理汇总了PHP中DOMElement::getElementsbyTagName方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMElement::getElementsbyTagName方法的具体用法?PHP DOMElement::getElementsbyTagName怎么用?PHP DOMElement::getElementsbyTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::getElementsbyTagName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseIdentification
/**
* 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;
}