xmlrpcDecodeValue()

Re-converts an XmlRpc-coded string to a variable.

Synopsis

int xmlrpcDecodeValue(string res, anytype &value[, bool isUTF = false]);

Parameters

Parameter Description
res The XmlRpc-coded string to be re-converted to a variable.
value Return value. The variable in re-converted format. Either of the data type anytype or mixed.
isUTF

Strings are decoded according to the following schema:

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

If isUTF == 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

Re-converts an XmlRpc-coded string to a variable.

Example

Reconverts an XmlRpc-coded string to a variable.

#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