Yes it is possible. You can use JTidy (
http://sourceforge.net/projects/jtidy/) which is the
Java port of the older Tidy HTML parser/cleaner ... in it there is a conversion tool for converting HTML into XHTML which is the valid XML version of HTML (for all intents and purposes). I have used it before and it is pretty handy.
Hope this helps
------------------
Chris Stehno (Sun Certified Programmer for the Java 2 Platform)