Fix handling of newlines and extra white space in text nodes.