- abc<-""welcome <span class="r"><a href="abc">abc</a></span> Have fun!""
- abc<-"welcome Have fun"
- > gsub("(<[^>]*>)","",abc)
- abc <- "welcome <span class="r"><a href="abc">abc</a></span> Have fun!"
- library(XML)
- #doc <- htmlParse(abc, asText=TRUE)
- doc <- htmlTreeParse(abc, asText=TRUE)
- xmlValue( xmlRoot(doc) )
- f <- function(x) if(xmlName(x) == "span") xmlTextNode(" ") else x
- d <- xmlDOMApply( xmlRoot(doc), f )
- xmlValue(d)