Skip to content

Commit

Permalink
Merge pull request #335 from jread-usgs/master
Browse files Browse the repository at this point in the history
gets rid of No encoding supplied: defaulting to UTF-8.
  • Loading branch information
Jordan S Read committed Mar 27, 2017
2 parents 03c2624 + d57133d commit bc8806b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ importFrom(XML,xmlParse)
importFrom(XML,xmlParseString)
importFrom(XML,xmlRoot)
importFrom(XML,xmlToList)
importFrom(XML,xmlTreeParse)
importFrom(XML,xmlValue)
importFrom(XML,xpathApply)
importFrom(curl,curl_version)
Expand Down
9 changes: 6 additions & 3 deletions R/03-geojob-obj.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ setMethod("geojob", signature("XMLDocument"), function(xml, ...) {
setMethod("geojob", signature("character"), function(xml, ...) {
#parse based on xml class
if(length(xml == 1) && startsWith(x = xml, prefix= "http")){
xml <- gGET(xml)
}
doc <- xmlTreeParse(xml)
response <- gGET(xml)
doc <- gcontent(response, useInternalNodes = FALSE)
} else {
doc <- xmlParse(xml, useInternalNodes = FALSE)
}

job <- geojob(xml = doc, ...)
return(job)
})
Expand Down
2 changes: 1 addition & 1 deletion R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#'@aliases check
#'@author Jordan S. Read
#'@seealso \code{\link{start}}
#'@importFrom XML xmlTreeParse xmlNamespaceDefinitions xmlRoot
#'@importFrom XML xmlNamespaceDefinitions xmlRoot
#' @importFrom httr http_error
#'@rdname check-geojob
#'@examples
Expand Down
2 changes: 1 addition & 1 deletion R/email-geojob.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ setGeneric(name="email",def=function(geojob, knife){standardGeneric("email")})
setMethod(f = "email",signature = c("geojob",'webprocess'),
definition = function(geojob, knife){

doc <- xmlTreeParse(xml(geojob), useInternalNodes = TRUE)
doc <- xmlParse(xml(geojob))
root <- xmlRoot(doc)
removeNodes(root[names(root) == "DataInputs"])
removeNodes(root[names(root) == "ResponseForm"])
Expand Down
4 changes: 2 additions & 2 deletions R/geoknifeUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ gPOST <- function(url, config = list(), ...){
#' @param response the result of httr::GET(url)
#' @keywords internal
#' @importFrom XML xmlParse
gcontent <- function(response){
XML::xmlParse(iconv(readBin(response$content, character()), from = "UTF-8", to = "UTF-8"))
gcontent <- function(response, useInternalNodes = TRUE){
XML::xmlParse(iconv(readBin(response$content, character()), from = "UTF-8", to = "UTF-8"), useInternalNodes = useInternalNodes)
}
2 changes: 1 addition & 1 deletion man/gcontent.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/testthat/test-show_object.R
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
context("show webdata")

test_that("show webdata", {
webdata()
expect_output(show(webdata()))
})

context("show webgeom")

test_that("show webgeom", {
webgeom()
expect_output(show(webgeom()))
})

context("show simplegeom")

test_that("show simplegeom", {
simplegeom(c(-88.6, 45.2))
expect_output(show(simplegeom(c(-88.6, 45.2))))
expect_error(simplegeom(c(-88.6, 45.2,99)))
})

context("show datagroup")

test_that("show datagroup", {
query('webdata')
expect_output(show(query('webdata')))
})

context("show geojob")

test_that("show geojob", {
geojob()
expect_output(show(geojob()))
})

context("show webprocess")

test_that("show webprocess", {
webprocess()
expect_output(show(webprocess()))
})

0 comments on commit bc8806b

Please sign in to comment.