Taking over output in your special page

Normally your Special page will queue up some HTML and/or wikitext output via $wgOut, which will take care of actual HTML output and skinning at the end of the request.

Sometimes though you want to output things directly, such as to export a custom XML type, data feed, or binary download.

It's not too hard to do, but it's not super-obvious either...

Here's some example bits snipped from Special:Export:

In your SpecialPage class's execute method: