As it is in 2.9 asXml prints document or node with its child nodes recursively and:
1. Inserts an indentation that is impossible to turn off.
2. Does not process html entities back, e.g. in the original document ends up as " " (char #160) in the one obtained via .asXml()
What is wanted is functionalty like dom4j's HTMLWriter