I have this code:
# Downloading data from IMF via JSON
u.xml <- "http://dataservices.imf.org/REST/SDMX_XML.svc/CompactData/IFS/Q..BFDA_BP6_USD.?startPeriod=2000&endPeriod=2022"
## parse the xml document and get the top-level XML node
doc <- xmlParse(u.xml)
top <- xmlRoot(doc)
Now, my question is how to turn top into a data.frame table? Thank you very much!
P.S. Desired data.frame table looks like this:
FREQ REF_AREA INDICATOR UNIT_MULT TIME_FORMAT TIME_PERIOD OBS_VALUE
1 Q BS BFDA_BP6_USD 6 P3M 2000-Q1 0
2 Q BS BFDA_BP6_USD 6 P3M 2000-Q2 0
...