i've read question parse xml files (>1 megabyte) in r , answer seems apply original xml package in r. how set option in xml2?
here code i'm running:
library(xml2) library(magrittr) rawxml <- read_xml(xmlfile) emails <- xml_find_all(rawxml, "//header") emailelements <- sapply(1:length(emails), function(idx) { attrs <- xml_attrs(emails[idx])[[1]] index <- attrs['index'] sender <- attrs['from'] ... contentlink <- attrs['contentlink'] #is *.html file rawcontenttext <- read_html(contentlink) content <- xml_text(rawcontenttext) ... v <- c(index, date, sender, subject, headerlink, rawlink, contentlink, content, attachmentlink) return(v) }) here error get:
error: excessive depth in document: 256 use xml_parse_huge option [1] thanks in advance.
Comments
Post a Comment