try to make function xml_parse thread safe