clear media array before parsing the xml and added a buffer for search results