Extend the asXml functionality to hanlde embedded objects.

merge to mainline