function xmlrpc_value_get_xml
Generates XML representing the given value.
Parameters
$xmlrpc_value: A value to be represented in XML.
Return value
XML representation of $xmlrpc_value.
2 calls to xmlrpc_value_get_xml()
- xmlrpc_request in includes/
xmlrpc.inc - Constructs an object representing an XML-RPC request.
- xmlrpc_server in includes/
xmlrpcs.inc - Invokes XML-RPC methods on this server.
File
-
includes/
xmlrpc.inc, line 96
Code
function xmlrpc_value_get_xml($xmlrpc_value) {
switch ($xmlrpc_value->type) {
case 'boolean':
return '<boolean>' . ($xmlrpc_value->data ? '1' : '0') . '</boolean>';
case 'int':
return '<int>' . $xmlrpc_value->data . '</int>';
case 'double':
return '<double>' . $xmlrpc_value->data . '</double>';
case 'string':
// Note: we don't escape apostrophes because of the many blogging clients
// that don't support numerical entities (and XML in general) properly.
return '<string>' . htmlspecialchars($xmlrpc_value->data) . '</string>';
case 'array':
$return = '<array><data>' . "\n";
foreach ($xmlrpc_value->data as $item) {
$return .= ' <value>' . xmlrpc_value_get_xml($item) . "</value>\n";
}
$return .= '</data></array>';
return $return;
case 'struct':
$return = '<struct>' . "\n";
foreach ($xmlrpc_value->data as $name => $value) {
$return .= " <member><name>" . check_plain($name) . "</name><value>";
$return .= xmlrpc_value_get_xml($value) . "</value></member>\n";
}
$return .= '</struct>';
return $return;
case 'date':
return xmlrpc_date_get_xml($xmlrpc_value->data);
case 'base64':
return xmlrpc_base64_get_xml($xmlrpc_value->data);
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.