The reason was that if you did response=$(curl ...) all escaped characters were lost, including new lines and tabulations. So I needed to xmllint it again.

Now I found that setting the variable IFS to empty before anything solves the problem. Now xmlling can stay in the curl line.

Source: http://stackoverflow.com/questions/11564778/bash-special-characters-lost-when-reading-file