{"action":"created","issue":{"url":"https://api.github.com/repos/ropensci/rentrez/issues/82","repository_url":"https://api.github.com/repos/ropensci/rentrez","labels_url":"https://api.github.com/repos/ropensci/rentrez/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/ropensci/rentrez/issues/82/comments","events_url":"https://api.github.com/repos/ropensci/rentrez/issues/82/events","html_url":"https://github.com/ropensci/rentrez/issues/82","id":156838388,"number":82,"title":"entrez_summary doesn't like nested XML in JSON or XML(sampledata)","user":{"login":"tomck","id":324521,"avatar_url":"https://avatars.githubusercontent.com/u/324521?v=3","gravatar_id":"","url":"https://api.github.com/users/tomck","html_url":"https://github.com/tomck","followers_url":"https://api.github.com/users/tomck/followers","following_url":"https://api.github.com/users/tomck/following{/other_user}","gists_url":"https://api.github.com/users/tomck/gists{/gist_id}","starred_url":"https://api.github.com/users/tomck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomck/subscriptions","organizations_url":"https://api.github.com/users/tomck/orgs","repos_url":"https://api.github.com/users/tomck/repos","events_url":"https://api.github.com/users/tomck/events{/privacy}","received_events_url":"https://api.github.com/users/tomck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-25T20:05:34Z","updated_at":"2016-05-25T23:09:15Z","closed_at":null,"body":"```\r\ncp460 <- entrez_summary(db=\"biosample\", id=\"2886856\", rettype=\"JSON\")\r\n> cp460$sampledata\r\n[1] \"&lt;BioSample submission_date=\\\"2014-06-26T08:08:36.203\\\" last_update=\\\"2015-08-10T23:52:20.737\\\" publication_date=\\\"2014-06-26T08:08:36.203\\\" access=\\\"public\\\" id=\\\"2886856\\\"\r\n[snip]\r\n```\r\n\r\nAbove is a testcase, below is how it looks direct:\r\nhttp://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=biosample&id=2886856&version=2.0&retmode=json\r\n\r\n(very confusing that for eutils it's retmode but rentrez it's rettype, but I digress)\r\n\r\nExpected results: ability to take things like cp460$sampledata$latitude and cp460$sampledata$longitude\r\nActual results: XML as escaped text"},"comment":{"url":"https://api.github.com/repos/ropensci/rentrez/issues/comments/221734508","html_url":"https://github.com/ropensci/rentrez/issues/82#issuecomment-221734508","issue_url":"https://api.github.com/repos/ropensci/rentrez/issues/82","id":221734508,"user":{"login":"dwinter","id":103573,"avatar_url":"https://avatars.githubusercontent.com/u/103573?v=3","gravatar_id":"","url":"https://api.github.com/users/dwinter","html_url":"https://github.com/dwinter","followers_url":"https://api.github.com/users/dwinter/followers","following_url":"https://api.github.com/users/dwinter/following{/other_user}","gists_url":"https://api.github.com/users/dwinter/gists{/gist_id}","starred_url":"https://api.github.com/users/dwinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwinter/subscriptions","organizations_url":"https://api.github.com/users/dwinter/orgs","repos_url":"https://api.github.com/users/dwinter/repos","events_url":"https://api.github.com/users/dwinter/events{/privacy}","received_events_url":"https://api.github.com/users/dwinter/received_events","type":"User","site_admin":false},"created_at":"2016-05-25T23:09:15Z","updated_at":"2016-05-25T23:09:15Z","body":"Thanks for the report @tomck , \r\n\r\n`retmode` and `rettype` are both valid eutils arguments, I don't think the rentrez docs discuss the difference, which might be a useful thing to do. \r\n\r\nFor this use case, it's very hard to make this an \"automatic\" part on `entrez_summary` because there is no indication which fields from which databases are going to have these XML-ish entries. And the XML itself is hard to parse cleanly.\r\n\r\nOn the other hand, we could either document a workaround or provide a function to handle thise. \r\n\r\nI'll think about that, in the mean time, in this specific case I think the escaped XML is actually what get's returned by efetch. So you could do this to get the results you are interested in:\r\n\r\n```r\r\ncp460 <- entrez_fetch(db=\"biosample\", id=2886856, rettype=\"xml\", parsed=TRUE)\r\nlat <- XML::xmlValue(cp460[[\"//Attribute[@attribute_name='latitude']\"]])\r\nlon <- XML::xmlValue(cp460[[\"//Attribute[@attribute_name='longitude']\"]])\r\nc(lat, lon)\r\n```\r\n```\r\n[1] \"40.79108\"  \"-73.96178\"\r\n```\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"dwinter"}}