0

I'm trying to do some text mining to elsevier articles. I had downloaded the articles in XML format and i successfully used the XML2 library to read the text I needed.

My problem is to get data from the attribute fields, like this one:

<ce:date-received day="17" month="11" year="2016"/>

Reading the file xx <- read_xml(filename) and then trying to call xml_find_all(xx, ".//ce:date-received") isn't working (no results). xml_attr(xx,"day") isn't working either.

What is the right way to do this?

Thanks.

HaReL
  • 348
  • 5
  • 12
  • 2
    This should help: https://stackoverflow.com/questions/45634155/parse-nested-xml-with-namespaces-in-r You need to be careful with those namespaces (the "ce:" part). It would be easier to help if you actually put a minimal [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) in the question itself that we can copy/paste to test with. – MrFlick Oct 03 '18 at 21:19
  • Great, thanks. that answer did help. – HaReL Oct 03 '18 at 21:52

0 Answers0