xml: Better whitespace output and other cleanup.

 * Don't touch existing stuff which already has a parent.

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
6 files changed