The XML declaration MUST be in the first line of an document. Maybe that breaks the page (as things are more strict there).
With the DOCTYPE it's not that strict, most browsers just ignore the declaration if it's not on the first line (which is most likely unwanted too since it triggers Quirks mode).

XHTML is a bit of overkill anyay, why not use HTML 4.01? It's an interesting subject. Valid XHTML 1.0 code is actually invalid HTML 4.01 - the MIME-type decides how a document gets served. If it's sent as text/html, it gets treated as HTML (probably 99% of websites). IE 6.0 doesn't even know application/xhtml+xml.

Oh I didn't read that you already noticed the empty first line. The code of the plugin shouldn't produce whitespace.
Your generated XML works if the first empty line is removed, I just tested and it's well-formed...