in reply to creating xml from cgi

Do the methods you're using send a valid http header with your direct output? This error is being sent by your web server, which needs to receive the header when serving content from cgi. Web browsers don't need the header when reading from a file.