1

I am a newbie to R and xml, and i would like to fetch some data from a webpage, however, my code fails due to (I guess) xml namespace, (correct me if i am wrong), what should i do to make my code ok?

data <- "http://usda.mannlib.cornell.edu/usda/current/wasde/wasde-01-12-2015.xml"
path <- "//sr15//matrix1//attribute4[@attribute4='Ending Stocks']//m1_year_group[@market_year4='2013/14 Est.']//Cell"
getNodeSet(data,path)

returns NULL

Nevertheless, if I parse a different xml without xmlns="wasde", it's possible to read

data2 <- "http://usda.mannlib.cornell.edu/usda/waob/wasde//2010s/2014/wasde-12-10-2014.xml"

getNodeSet(data2,path)

Any thought? Many thanks in advance.

pidig89
  • 169
  • 1
  • 11
  • 1
    possible duplicate of [XPath and namespace specification for XML documents with an explicit default namespace](http://stackoverflow.com/questions/24954792/xpath-and-namespace-specification-for-xml-documents-with-an-explicit-default-nam) – kjhughes Feb 03 '15 at 13:32
  • thanks a lot, that indeed solve my problem – pidig89 Oct 27 '15 at 08:30
  • 1
    Hi. I have exactly the same problem for the same dataset! The link wasn't clear to me unfortunately... Is there any chance you would write a hint on the solution you took? Thanks!! – Matifou Jul 01 '16 at 10:18
  • Hi @Matifou, can you be more precise on what blocks you? in fact, I just run through what kjhughes has shared. Let me know if you still have the issue. – pidig89 Aug 26 '16 at 05:39

0 Answers0