Fix html xml and newline validation, improve validation speed on server side