Hi all - I am trying to parse out the attached XML file into a data frame. The file is extracted from Hadoop File Services (HFS). I am new in using the XML package so need some help in parsing out the data. Below is some code that I explore to get the attribute into a data frame. Any help is appreciated.
library(XML) temp <- xmlParseDoc("sample.xml") temp.root <- xmlRoot(temp) xmlName(temp.root) xmlSize(temp.root) #21 child nodes temp.root[[2]] #headers temp.root[[2]][[2]] #extracts just the revision temp.2 <- xmlToList(temp.root[[2]]) #extracts the info in temp.root[[2]] into a list temp.2 temp.2.df <- xmlToDataFrame(temp.root[[2]]) #data frame of the list temp.2.df xmlValue(temp.root[[2]]) #string the values of the node inside [[2]] temp.revision <- xmlValue(temp.root[[2]][["Revision"]]) temp.revision test <- xmlTreeParse("sample.xml") test -- View this message in context: http://r.789695.n4.nabble.com/Parsing-XML-file-to-data-frame-tp4689883.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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.