Er, I failed to include the step to write the repaired data to a file... fnamenobom <- "nobom.xml" cat( paste( txt, collapse="\n" ), file=fnamenobom ) xmlfile <- xmlTreeParse( fnamenobom )
-- Sent from my phone. Please excuse my brevity. On July 28, 2016 11:20:23 AM PDT, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: >Please keep the list included in the thread (e.g. reply-all?). > >I looked at the file and agree that it looks like xml with a utf8 byte >order mark and Unix line endings, which means it is not XLS and it is >not XLSX (which is a zipped directory of xml files with DOS line >endings). Excel complains but manages to open the file if it has the >XLS extension, but I am not aware that any of the usual R Excel >packages will understand this file. > >The byte order mark can be addressed by opening the file with >encoding="UTF-8-BOM", but as you mentioned originally the XML structure >is still broken (c.f. the error message about the Style ending tag). >Line 16 seems to use /Style rather than /ss:Style. Maybe > >library(XML) >txt <- readLines( fname, encoding="UTF-8-BOM" ) >txt <- sub( "</Style>", "</ss:Style>", txt ) >fnamenobom <- "nobom.xml" >xmlfile <- xmlTreeParse( "nobom.xml" ) ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.