library(XML) #Read in XML string str <- readLines(tc <- textConnection(' ')) close(tc) str