2

The problem happens when I am trying to import OECD data. For example, if I try the following code:

library(rsdmx)
data.url <- "http://stats.oecd.org/restsdmx/sdmx.ashx/GetData/QNA/AUS.B1_GE+P3+P31S14_S15+P3S13+P5+P51+P52_P53+P52+P53+B11+P6+P61+P62+P7+P71+P72+RB1_GE+PPPGDP+P41+P3_P51+P3_P5.CQRSA.Q/all?startTime=2011-Q1&endTime=2015-Q2"
my.sdmx <- readSDMX(data.url)

I get the following error

<XMLInputError: XML content does not seem to be XML: '<message:MessageGroup xmlns="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/generic"  ...

However, this only seems to happen with OECD data. If I replace data.url above with

data.url <- "http://data.fao.org/sdmx/repository/data/CROP_PRODUCTION/.156.5312../FAO?startPeriod=2008&endPeriod=2008"

then the code runs smoothly. It also works if I download the XML file and parse it using readSDMX('file.xml', isURL=FALSE).

I wonder if this has anything to do with the '' characters that show up when parsing OECD XML, and if there is a way to fix this.

Christophe Roussy
  • 16,299
  • 4
  • 85
  • 85
Gustavo
  • 53
  • 3

1 Answers1

0

There has been some recent changes in OECD portal. One of them was that the web requests did not return a valid xml response. The few characters you mentioned correspond to the Bytes Order Mark (BOM). A control has been added very recently in rsdmx to manage properly such BOM, change that has also been reflected in CRAN. Upgrading to rsdmx 0.4-7 will solve your issue.

eblondel
  • 603
  • 4
  • 10
  • I have tested with rsdmx_0.5-11 and it is as broken as ever... Or was it fixed and then broken again? Either way, neither this nor OECD package route works (with the same error) – BBB Jun 18 '18 at 06:23
  • Unfortunately, OECD server itself has been subject of regressions, so any SDMX client, like rsdmx inherits it. rsdmx aligns on the SDMX standard. If you suspect there is a bug in rsdmx, feel free to submit a ticket at https://github.com/opensdmx/rsdmx/issues – eblondel Jul 28 '18 at 12:34