Fix maybe uninitialized warning and add XML sanity check
this sits on top of !134 (merged) to get the formatting fix from there.
The actual changes are in 4fae2ba2
this sits on top of !134 (merged) to get the formatting fix from there.
The actual changes are in 4fae2ba2