Refactor dom-to-xhtml