0
votes

I am trying to import data from a publicly available XML source into my Google Sheet. The data is available as a direct link from an HTML representation - the XML file contains the same data. Reference: https://cordis.europa.eu/project/rcn/214839/factsheet/en and https://cordis.europa.eu/project/rcn/214839_en.xml

I've been browsing various different sources, and nothing helps so far. It seems that Google can read the data because of the statements

IMPORTXML("https://cordis.europa.eu/project/rcn/214839_en.xml", "*")

and

=IMPORTXML("https://cordis.europa.eu/project/rcn/214839_en.xml", "//*")

produce results.

However, simple XPath statements such as //rcn or /project/rcn/text() bark back at me with an "N/A" result.

What am I doing wrong here?

1
That XML document has a default namespace declaration with http://cordis.europa.eu URI in the root element. - Alejandro
Yes it does - but that is perfectly valid XML AFAIK (and w3schools.com XML validator sells me so, too) If it werent valid XML, then the "*" shouldn't have imported anything, shouldn't it? - MDr
I'm pointing you to the well known problem when trying to select with the //rcn expression meaning that the element rcn is under the empty namespace... - Alejandro

1 Answers

0
votes

You'll want to use the local-name function.

=IMPORTXML("https://cordis.europa.eu/project/rcn/214839_en.xml","//*[local-name()='rcn']")