updated logic for stringifying xml nodes