Revert "Simplify logic in XML generator."

This (partially) reverts commit f110e5bfd9048850d169343024d7ac6a0ff31c56.
Turns out all this null-checking is necessary, probably because of bugs
in FlowSensitive and FlowInsensitive kind analyses...