bmc_xml: Download full text xml of a BMC paper.

Description Usage Arguments Examples

View source: R/bmc_xml.r

Description

Download full text xml of a BMC paper.

Usage

1
bmc_xml(obj = NULL, uris = NULL, dir = NULL, raw = FALSE, ...)

Arguments

obj

(optional) An object of class bmc, from a call to bmc_search

uris

(optional) A uri to a xml file of a BMC paper

dir

(optional) A directory to save to. The file extension is forced to .xml, and the file name will be

raw

(logical) If TRUE, returns raw text, but if FALSE, parsed XML. Default: FALSE

...

Futher args passed on to httr::GET for debugging curl calls.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
uri = 'http://www.biomedcentral.com/content/download/xml/1471-2393-14-71.xml'
uri = 'http://www.springerplus.com/content/download/xml/2193-1801-3-7.xml'
uri = 'http://www.microbiomejournal.com/content/download/xml/2049-2618-2-7.xml'
bmc_xml(uris=uri)
bmc_xml(uri, dir='~/')
bmc_xml(uri, verbose())

# from using bmc_search
out <- bmc_search(terms = 'science', limit=5)
dat <- bmc_xml(out)
length(dat)
library(plyr)
dat <- compact(dat)
length(dat)
dat
library(XML)
xpathApply(dat[[1]], "//abs", xmlValue)
saveXML(dat[[1]], file = 'myxml.xml')

# curl debugging, and other parameters passed to \code{httr::GET}
uri = 'http://www.microbiomejournal.com/content/download/xml/2049-2618-2-7.xml'
res <- bmc_xml(uris=uri, config=verbose())
res <- bmc_xml(uris=uri, config=timeout(0.1))

uri1 = 'http://www.biomedcentral.com/content/download/xml/1471-2393-14-71.xml'
uri2 = 'http://www.springerplus.com/content/download/xml/2193-1801-3-7.xml'
uri3 = 'http://www.microbiomejournal.com/content/download/xml/2049-2618-2-7.xml'
res <- bmc_xml(uris=list(uri1, uri2, uri3), config=progress())

## End(Not run)

ropensci/bmc documentation built on July 11, 2017, 8:20 p.m.