Revision 70f7466a7c66e2a27541b52c88142ab5eb669f15 authored by Duncan Temple Lang on 27 November 2000, 00:00:00 UTC, committed by Gabor Csardi on 27 November 2000, 00:00:00 UTC
1 parent 6528a2c
Raw File
xmlEventParse.R
xmlEventParse <- 
#
# Parses an XML file using an event parser which calls user-level functions in the
# `handlers' collection when different XML nodes are encountered in the parse stream.
#
# See also xmlParseTree()
#
function(file, handlers=xmlEventHandler(), ignoreBlanks=F, addContext = T, useTagName = T,
           asText = F, trim=T, useExpat = F, isURL=F) 
{
  if(missing(isURL)) { 
        # check if this is a URL or regular file.
    isURL <- length(grep("http://",file)) | length(grep("ftp://",file))
  }

 if(isURL == F & asText == F) {
  if(file.exists(file) == F)
     stop(paste("File", file, "does not exist "))
 }

 handlers <- .Call("RS_XML_Parse", as.character(file), handlers, 
                    as.logical(addContext), as.logical(ignoreBlanks),  
                     as.logical(useTagName), as.logical(asText), as.logical(trim), 
                      as.logical(useExpat))
 return(invisible(handlers))
}
back to top