private object ParseXml(XmlElement inParam)
{
XmlElement val;
if (inParam["value"] == null)
{
val = inParam;
}
else
{
val = inParam["value"];
}
if (val["string"] != null) // param of type string ...
{
return val["string"].InnerText;
}
else if (val["int"] != null) // param of type int32 ...
{
return Int32.Parse(val["int"].InnerText);
}
else if (val["i4"] != null) // param of type int32 (alternative) ...
{
return Int32.Parse(val["i4"].InnerText);
}
else if (val["double"] != null) // param of type double ...
{
return double.Parse(val["double"].InnerText);
}
else if (val["boolean"] != null) // param of type boolean ...
{
if (val["boolean"].InnerText == "1")
return true;
else
return false;
}
else if (val["struct"] != null) // param of type struct ...
{
Hashtable structure = new Hashtable();
foreach (XmlElement member in val["struct"])
{
// parse each member ...
structure.Add(member["name"].InnerText, ParseXml(member));
}
return structure;
}
else if (val["array"] != null) // param of type array ...
{
ArrayList array = new ArrayList();
foreach (XmlElement data in val["array"]["data"])
{
// parse each data field ...
array.Add(ParseXml(data));
}
return array;
}
else if (val["base64"] != null) // param of type base64 ...
{
byte[] data = Convert.FromBase64String(val["base64"].InnerText);
return data;
}
return null;
}