$value) { if (_xrds_strip_namespace($attribute_name) == 'PRIORITY') { $xrds_current_service['priority'] = intval($value); } } } } function _xrds_element_end(&$parser, $name) { global $xrds_open_elements, $xrds_services, $xrds_current_service; $name = _xrds_strip_namespace($name); if ($name == 'SERVICE') { if (!isset($xrds_current_service['priority'])) { // If the priority attribute is absent, the default is infinity. $xrds_current_service['priority'] = PHP_INT_MAX; } $xrds_services[] = $xrds_current_service; $xrds_current_service = array(); } array_pop($xrds_open_elements); } function _xrds_cdata(&$parser, $data) { global $xrds_open_elements, $xrds_services, $xrds_current_service; $path = strtoupper(implode('/', $xrds_open_elements)); switch ($path) { case 'XRDS/XRD/SERVICE/TYPE': $xrds_current_service['types'][] = $data; break; case 'XRDS/XRD/SERVICE/URI': $xrds_current_service['uri'] = $data; break; case 'XRDS/XRD/SERVICE/DELEGATE': $xrds_current_service['delegate'] = $data; break; case 'XRDS/XRD/SERVICE/LOCALID': $xrds_current_service['localid'] = $data; break; } } function _xrds_strip_namespace($name) { // Strip namespacing. $pos = strrpos($name, ':'); if ($pos !== FALSE) { $name = substr($name, $pos + 1, strlen($name)); } return $name; }