function xmlrpc_message_parse

7.x xmlrpc.inc xmlrpc_message_parse($xmlrpc_message)
6.x xmlrpc.inc xmlrpc_message_parse(&$xmlrpc_message)

Parse an XML-RPC message. If parsing fails, the faultCode and faultString will be added to the message object.

Parameters

$xmlrpc_message: Object generated by xmlrpc_message()

Return value

TRUE if parsing succeeded; FALSE otherwise

2 calls to xmlrpc_message_parse()
xmlrpc_server in drupal-6.x/includes/xmlrpcs.inc
The main entry point for XML-RPC requests.
_xmlrpc in drupal-6.x/includes/xmlrpc.inc
Execute an XML remote procedural call. This is private function; call xmlrpc() in common.inc instead of this function.

File

drupal-6.x/includes/xmlrpc.inc, line 158
Drupal XML-RPC library. Based on the IXR - The Incutio XML-RPC Library - (c) Incutio Ltd 2002-2005 Version 1.7 (beta) - Simon Willison, 23rd May 2005 Site: http://scripts.incutio.com/xmlrpc/ Manual: http://scripts.incutio.com/xmlrpc/manual.php This…

Code

function xmlrpc_message_parse(&$xmlrpc_message) {
  $xmlrpc_message->_parser = xml_parser_create();
  // Set XML parser to take the case of tags into account.
  xml_parser_set_option($xmlrpc_message->_parser, XML_OPTION_CASE_FOLDING, FALSE);
  // Set XML parser callback functions
  xml_set_element_handler($xmlrpc_message->_parser, 'xmlrpc_message_tag_open', 'xmlrpc_message_tag_close');
  xml_set_character_data_handler($xmlrpc_message->_parser, 'xmlrpc_message_cdata');
  xmlrpc_message_set($xmlrpc_message);
  if (!xml_parse($xmlrpc_message->_parser, $xmlrpc_message->message)) {
    return FALSE;
  }
  xml_parser_free($xmlrpc_message->_parser);
  // Grab the error messages, if any
  $xmlrpc_message = xmlrpc_message_get();
  if (!isset($xmlrpc_message->messagetype)) {
    return FALSE;
  }
  elseif ($xmlrpc_message->messagetype == 'fault') {
    $xmlrpc_message->fault_code = $xmlrpc_message->params[0]['faultCode'];
    $xmlrpc_message->fault_string = $xmlrpc_message->params[0]['faultString'];
  }
  return TRUE;
}