
Last chance! 50% off unlimited learning
Sale ends in
Create an XML source.
XMLSource(x, parser, reader)
a character giving a uniform resource identifier.
a function accepting an XML tree (as delivered by
xmlTreeParse
in package XML) as input and returning
a list of XML elements.
a function capable of turning XML elements as
returned by parser
into a subclass of TextDocument
.
An object inheriting from XMLSource
, SimpleSource
,
and Source
.
Source
for basic information on the source infrastructure
employed by package tm.
Vignette 'Extensions: How to Handle Custom File Formats', and
readXML
.
# NOT RUN {
## An implementation for readGmane is provided as an example in ?readXML
example(readXML)
## Construct a source for a Gmane mailing list RSS feed.
GmaneSource <-
function(x)
XMLSource(x,
function(tree) {
nodes <- XML::xmlChildren(XML::xmlRoot(tree))
nodes[names(nodes) == "item"]
},
readGmane)
# }
# NOT RUN {
gs <- GmaneSource("http://rss.gmane.org/gmane.comp.lang.r.general")
elem <- getElem(stepNext(gs))
(gmane <- readGmane(elem, language = "en", id = "id1"))
meta(gmane)
# }
Run the code above in your browser using DataLab