Created
September 12, 2012 17:45
-
-
Save sckott/3708508 to your computer and use it in GitHub Desktop.
gotta suppress the damn namespace warning in XML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr); library(XML) | |
url <- "http://data.gbif.org/ws/rest/occurrence/list?scientificname=Accipiter%20erythronemius&coordinatestatus=TRUE&maxresults=100" | |
tt <- content(GET(url), as="text") | |
out <- xmlTreeParse(tt)$doc$children$gbifResponse | |
d> getNodeSet(out, "//to:TaxonOccurrence") # throws errors even though the output is what I want | |
Namespace prefix to on TaxonOccurrence is not defined | |
Namespace prefix to on catalogNumber is not defined | |
Namespace prefix to on country is not defined | |
... (output abbreviated) | |
[[1]] | |
<TaxonOccurrence gbifKey="621073312" about="http://data.gbif.org/ws/rest/occurrence/get/621073312"> | |
<catalogNumber>42227</catalogNumber> | |
<country>Argentina</country> | |
<decimalLatitude>-27.352036</decimalLatitude> | |
<decimalLongitude>-65.596112</decimalLongitude> | |
<identifiedTo> | |
<Identification> | |
<taxon> | |
<TaxonConcept gbifKey="57246512" about="http://data.gbif.org/ws/rest/taxon/get/57246512"> | |
<hasName> | |
<TaxonName> | |
<nameComplete>Accipiter erythronemius</nameComplete> | |
<specificEpithet>erythronemius</specificEpithet> | |
<scientific>true</scientific> | |
</TaxonName> | |
</hasName> | |
</TaxonConcept> | |
</taxon> | |
<taxonName>Accipiter erythronemius</taxonName> | |
</Identification> | |
</identifiedTo> | |
</TaxonOccurrence> | |
... (output abbreviated) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment