R/getXML.R

Defines functions `getXML`

#' @description Read the DDI XML file
#' @return An XML document
#' @noRd
`getXML` <- function(path) {
    tc <- admisc::tryCatchWEM(xml <- xml2::read_xml(path))

    if (is.null(tc$error)) {
        return(xml)
    }
    else {
        # xml <- readLines(path)
        # nms <- grepl("xmlns", xml[which(grepl("codeBook", xml))[1]])

        admisc::stopError("Unable to read the XML file.")
    }
}

Try the DDIwR package in your browser

Any scripts or data that you put into this service are public.

DDIwR documentation built on Oct. 1, 2023, 5:06 p.m.