I am new to web scraping. I am trying to scrape the below XML file on the the NY Fed reserve website using the XML library
fedops <- xmlparse("https://markets.newyorkfed.org/api/ambs/all/results/details/search.sdmx.xml?startdate=03/02/2020&enddate=04/07/2020")
but then i get the below error. I am not sure how to proceed here, it appears to be an xml file, but maybe i should be using rvest and read_html? any help would be great. Thanks in advance.
Error: XML content does not seem to be XML: 'ddate=04/07/2020'
It's recommended to use xml2
to work with XML:
library(xml2)
pg <- read_xml("https://markets.newyorkfed.org/api/ambs/all/results/details/search.sdmx.xml?startdate=03/02/2020&enddate=04/07/2020")
sections <- pg %>% xml_find_all("//n1:Section")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.