Forum Discussion

naalco72's avatar
naalco72
Visitor
14 years ago

How to call a function located In an XML file

Hi i have XML file that do have number of items
each item have number of identifications like


<Category>
<item
type="English"
FUNCTION_TO_Call = "English()">
</item>
</Category>


as you can see that there is a text called English() defined in attribute Function_to_call

i was able tom get the text from XML file into my code using parsing method

but i don't fined any solution to instruct the program executor to call the function English() and run it

i use the following code


abc=kid.Function_to_call
abc()



it says that there is no reference available in abc()
but if i use


print kid.Function_to_call


i get what was saved in that attribute in XML file i get English() which is what i want to call for execution

is there any other method to do that

2 Replies

  • you might be able to do something like eval(kid.Function_to_call) to call the function.
  • Hi GPF thanks it was very helpful answer it worked perfectly
    thanks again