Unfortunately we can't simply reload the generated string as DOMDocument because on record-level we might not have all namespace definitions at hand, which leads to errors. This screws up pretty printing for now. Short of writing a custom pretty printing function I haven't found a way around that yet and formatOutput doesn't seem to work.