I expected google-code-prettify to do the job, but it doesn't seem to indent. With an extra indent plugin (vkbeautify), able to get the correct indented xml format.
http://plnkr.co/edit/Pep9HurLI8NPtAXRsoFD?p=preview
<div ng-controller="myCtrl"> <pre class="prettyprint lang-xml"></pre> </div> App.directive('prettyprint', function() { return { restrict: 'C', link: function postLink(scope, element, attrs) { element.text(vkbeautify.xml(scope.dom, 4)); } }; });
source share