Reformatted according to code standard
Simplified asPrettyXML()