xmlrpcEncodeValue()

Converts a "value" variable to an XmlRpc-coded string.

Synopsis

int xmlrpcEncodeValue(anytype value, string &res[, bool forceUTF = false]);

Parameters

Parameter Description
value The variable to be converted to an XmlRpc-coded string. The data type of the variable is arbitrary (not necessarily anytype).
res Return value. The converted string in XmlRpc format.
forceUTF

Strings are encoded according to the following schema:

If forceUTF == TRUE, then with UTF-8.

If forceUTF == FALSE:

If all configured languages are ISO8859-1, then with ISO8859-1.

Otherwise UTF-8.

Return value

The function returns 0 if it was executed successfully and -1 in case of errors.

Description

Converts a "value" variable to an XmlRpc-coded string.

Example

Converts a "value" variable to an XmlRpc-coded string.

#uses "CtrlXmlRpc"
main()
{
  dyn_int diArray = makeDynInt(5,4,3,2,1);
  string sXmlArray;
  //Convert the array to a string
  sXmlArray = convertMixedToXmlString(diArray);
  dyn_int diReturn;
  //Convert the string to an array
  diReturn = convertXmlStringToMixed(sXmlArray);
  DebugN("Data in Array: "+ diArray, "Data in XmlString:
  "+sXmlArray, "Data Result in Array: "+ diReturn);
}
mixed convertXmlStringToMixed(string sXmlData)
{
  mixed mxDataArray;
  //This function converts a string to a mixed variable
  xmlrpcDecodeValue(sXmlData, mxDataArray);
  return mxDataArray;
}
string convertMixedToXmlString(mixed mxDataArray)
{
  //This function converts a mixed variable to a string
  string sXmlData;
  xmlrpcEncodeValue(mxDataArray, sXmlData);
  return sXmlData;
}

Assignment

XML RPC

Availability

CTRL