in reply to Re^2: XML::Generator bad header?
in thread XML::Generator bad header?

OK, lets take a step back here, you are getting confused between what CGI is, and what the file is.

This is what a CGI application should return TO THE WEB SERVER.

-------------------------------------------------- Content-type: text/plain (or text/html and so on) Some-Other: headers (a blank line) The contents of the file goes here --------------------------------------------------

So to send a text file the CGI prints this to STDOUT:

-------------------------------------------------- Content-type: text/plain Hello World! --------------------------------------------------

... and a HTML file

-------------------------------------------------- Content-type: text/html <html> <body> Hello World! </body> </html> --------------------------------------------------

... and an XML file

-------------------------------------------------- Content-type: text/xml <?xml version="1.0" encoding="ISO-8859-1"?> <tag>Hello World!</tag> --------------------------------------------------

I hope by now you see it's quite obvious you can't just spit the output of a CGI into a file and expect a browser to load that file, because you've incorrectly stuffed the extra headers into the file.

It's no wonder the XML parser is freaking out.

If you make a script that uses CGI.pm and adds the headers to the output, you can ONLY run it in a webserver.

It's not useful for producing the file standalone any more.

20070821 Janitored by Corion: Fixed stray </code> tag