in reply to Re^2: Output of XML: "valid XML header needed"-error (OpenSearch)?
in thread Output of XML: "valid XML header needed"-error (OpenSearch)?

Try to write your XML to a file and configure Apache to send the application/opensearchdescription+xml Content-Type (that's what youtube uses).

Try to validate your XML, at least for well-formedness (for example with xmlstarlet), and use wget --server-response $url to check that your webserver delivers the right headers.

Could you tell us your URL, so that I can take a look as well?