Thank you Barry, that works fine.
Sorry for stupid questions... however, I couldn't manage to get a
dataframe out of this.
That's what I was doing:
doc = xmlRoot(xmlTreeParse("de.dwd.klis.TADM.xml"))
dumpData <- function(doc){
for(i in 1:length(doc)){
stns = doc[[i]]
for (j in 1:length(stns)){
cat(stns$attributes['value'],stns[[j]][[1]]$value,stns[[j]]
$attributes['date'],"\n")
}
}
}
dumpData(doc)
Thanks for your helping
kai
Am 29.06.2011 um 1106 schrieb Barry Rowlingson:
Run that on your doc to see it printed out. Save to a data frame if that's what you need. This is not the perfect way to do it, since if you have other (non <stationname> or <v>) elements it'll try and handle those too, and fail. There's probably a way of looping over all <stationname> elements but XML makes me feel sick when I try and remember how to parse it in R at this time of the morning. its probably in the docs but this should get you started. Barry