Update XMLTools.js

Update text to textContent
Add null check for doc when getting toObject