xml and text producer/listener. converted to helper functions