use \n instead of std::endl when writing xml to avoid flushing the output buffer