/** * Function: findNode * * Returns the first node where attr equals value. * This implementation does not use XPath. */ static function findNode($node, $attr, $value) { $tmp = $node->getAttribute($attr); if (isset($tmp) && $tmp == $value) { return $node; } $node = $node->firstChild; while (isset($node)) { $result = mxUtils::findNode($node, $attr, $value); if (isset($result)) { return $result; } $node = $node->nextSibling; } return null; }