Assuming you know the type, have an instance of it, and that the method is actually public:
string methodName = parent.Element("METHOD").Value;
MethodInfo method = type.GetMethod(methodName);
object[] arguments = (from p in method.GetParameters()
let arg = element.Element(p.Name)
where arg != null
select (object) arg.Value).ToArray();
// We ignore extra parameters in the XML, but we need all the right
// ones from the method
if (arguments.Length != method.GetParameters().Length)
{
throw new ArgumentException("Parameters didn't match");
}
method.Invoke(instance, arguments);
Note that I'm doing case-sensitive name matching here, which wouldn't work with your sample. If you want to be case-insensitive it's slightly harder, but still doable - personally I'd advise you to make the XML match the method if at all possible.
(If it's non-public you need to provide some binding flags to the call to GetMethod
.)