extract attributes from element in an xml file