Skip to content
Prev 309569 / 398506 Next

How to parse xml with same key name ?

On 01.11.2012 06:29, Manish Gupta wrote:
Hi!

I would start by looking at "A Short Introduction to the XML package for
R". The xPath part of the document seems relevant to your problem.
http://www.omegahat.org/RSXML/shortIntro.html

I'm not exactly sure of what you are trying to do, but here's a start:

foo <- xmlInternalTreeParse("yourfile.xml")
nodes <- getNodeSet(foo, "//node[@id]")
sapply(nodes, xmlGetAttr, "id")
sapply(nodes, xmlValue)