Reputation: 2886
I have read and parsed a url using htmlParse().
I have used xpathApply to filter out and get the exact content that I want.
I want to convert the list created into character. When I try to convert I get this error:
"<pointer: 0x000000001673db70>"
I am assuming that the parsed content is pointed in the main object using pointers.
The content that I want might have some some XML syntax in it, so xmlValue will do no good.
Upvotes: 1
Views: 1736
Reputation: 30425
You can use saveXML
to convert the internal nodes to characters:
library(XML)
appUrl <- 'http://cran.r-project.org/'
doc <- htmlParse(appUrl)
out1 <- xpathSApply(doc, "//*/frame")
out2 <- xpathSApply(doc, "//*/frame", saveXML)
> str(out1)
List of 3
$ :Classes 'XMLInternalElementNode', 'XMLInternalNode', 'XMLAbstractNode' <externalptr>
$ :Classes 'XMLInternalElementNode', 'XMLInternalNode', 'XMLAbstractNode' <externalptr>
$ :Classes 'XMLInternalElementNode', 'XMLInternalNode', 'XMLAbstractNode' <externalptr>
> str(out2)
chr [1:3] "<frame src=\"logo.html\" name=\"logo\" frameborder=\"0\"/>" ...
Upvotes: 6