First of all, what you have in those xml files. Are they label file or some configuration files or both.
Most of the object detection libraries (yolo, frcnn and their implementations) actually have in built support for handling the label files. If you are using yolo, just search "xml to yolo convertor githib"
You will find alot of scripts that can do that.
But if you want to learn by your self how to read and write xml files, here is a good tutorial