xhtml is infinitely "extensible", in essence, by the x itself so named. I suppose you don't mean you've your own custom module extending the base of it?... xhtml validation is no difference from validating any schema/DTD backed xml document and the outline of how to do it is already pointed out.
If you mean you are not yet very agile in doing validating xml, I would say you can use many validating service out there such as this or any other you might come across after by googling.
http://validator.w3.org/#validate_by_input
You can cut-and-paste the "string" for the purpose or you can use the variation of validating via a url...