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

Are you sure that the client doesn't expect a Content-Type: text/xml; charset=utf-8 header?

And you really print utf8? Did you do a Encode::decode("utf8", $string); before you wrote it?

And which client produces the error message?

Have you tried to run your script locally and validated the output against a schema?

Replies are listed 'Best First'.
Re^2: Output of XML: "valid XML header needed"-error (OpenSearch)?
by isync (Hermit) on Aug 24, 2007 at 17:23 UTC
    Yes, I am sure. (Although I tried all kinds of headers - no result.)

    I tried Encode::decode and had negative result with and without it.

    Its amazon's client. YouTube has (except the values) the exactly same opensearch file layout - I even tried copy and paste their content - and sent it to amazon A9. Result: Error: no valid XML header *in* file.

    Their works: http://a9.com/-/opensearch/?url=http%3A%2F%2Fwww.youtube.com%2Fopensearch
    What is the magic to properly identify an XML file...?
      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?