More work on correct wrapping of XML with weird stuff.