https://github.com/cran/XML
Revision a6d04915a4c3db8af6b85b5350e501939a3d8223 authored by Duncan Temple Lang on 14 May 2008, 00:00:00 UTC, committed by Gabor Csardi on 14 May 2008, 00:00:00 UTC
1 parent edc7cc3
Raw File
Tip revision: a6d04915a4c3db8af6b85b5350e501939a3d8223 authored by Duncan Temple Lang on 14 May 2008, 00:00:00 UTC
version 1.95-3
Tip revision: a6d0491
xmlHandler.R
xmlHandler <- 
function() {
  data <- list()
  startElement <- function(name, atts,...) {
    if(is.null(atts))
      atts <- list()
    data[[name]] <<- atts
  }
  text <- function(x,...) {
    cat("MyText:",x,"\n")   
  }
  comment <- function(x,...) {
    cat("comment", x,"\n")
  }
  externalEntity <- function(ctxt, baseURI, sysId, publicId,...) {
    cat("externalEntity", ctxt, baseURI, sysId, publicId,"\n")
  }
  entityDeclaration <- function(name, baseURI, sysId, publicId,notation,...) {
    cat("externalEntity", name, baseURI, sysId, publicId, notation,"\n")
  }

  foo <- function(x,attrs,...) { cat("In foo\n")}
  return(list(startElement=startElement, getData=function() {data},
               comment=comment, externalEntity=externalEntity,
                entityDeclaration=entityDeclaration,
                text=text, foo=foo))
}
back to top