../pvss.htm menu.gif basics.gif

xmlrpcEncodeValue()

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

Synopsis

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

Parameters

    Parameter

    Meaning

    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.

IconExample

#uses "CtrlXmlRpc"

 

main()

{

  dyn_int diArray = makeDynInt(5,4,3,2,1);

  string sXmlArray;

 

  //convert the Array to an XML String

  sXmlArray = convertMixedToXmlString(diArray);

  dyn_int diReturn;

 

  //convert the XML String to an Array

  diReturn = convertXmlStringToMixed(sXmlArray);

  DebugN("Data in Array: "+ diArray, "Data in XmlString: "+sXmlArray, "Data Result in Array: "+ diReturn);

}

 

string convertMixedToXmlString(mixed mxDataArray)

{

  //this function converts an mixed variable to a XML String

  string sXmlData;

 

  //decode sData String from XML to mixed

  xmlrpcEncodeValue(mxDataArray, sXmlData);

  return sXmlData;

}

Member of

XML-RPC, Basics

Availability

CTRL

See also

xmlrpcDecodeValue()

 

Top Of Page

 

V 3.11 SP1

Copyright ETM professional control GmbH 2013 All Rights Reserved