NOTE: the wiki markup is wrong - how can you expect DokuWiki to create valid HTML?
Of course, this has zero impact on usage of the excellent DokuWiki. However, is the "Valid XHTML 1.0" button really justified if the markup can be messed up that easy?
There are PHP wiki rendering engines that produce only valid XHTML output, such as WikiRenderer (http://ljouanneau.com/softs/wikirenderer/). I think that minimal checks of XHTML compatibility are absolutely necessary, be it before or after wiki to XHTML conversion. Another approach may be to use HTML Tidy to correct the output before display.