Add some nil checks for xmldom (and clean up a bit)
replace nil comparisons with calls to isNil
Merge pull request #1430 from def-/xmldom-nil

Add some nil checks for xmldom (and clean up a bit)