Path of xml files: the path isn't specified as relative or absolute, if you run the toot from other folder, the xml files aren't founded
Attribute control: some attribute can be undefined, for this reason the script crash
Variables name: ther are some variable with an incorrect name because abbreviated, for example response in res, and other with the name that is equal to a global variable in witch is needed to isert some data picked up from the local variable
There are 3 problems: