Fix GH-14638: null dereference after XML parsing failure. object document is null if the parsing had failed prior to cast to string.