For example 

 fileName <- system.file("exampleData", "mtcars.xml", package="XML")
 doc <- xmlTreeParse(fileName)
 r<-xmlRoot(doc)
 record<-r[["record"]]
 record
the result :
<record id="Mazda RX4">21.0   6 160.0 110 3.90 2.620 16.46  0  1    4    4</record>
but in the mecars.xml there are 32 sub-nodes called "record"

when I use xmlChildren function
c<-xmlChildren(r)[["record"]]


c is also like that
<record id="Mazda RX4">21.0   6 160.0 110 3.90 2.620 16.46  0  1    4    4</record>
just the first sub-node is the default  

My question is:
Is there a function that can get the sub-node according to the sub-node's attribute ?
like that,in the mtcar.xml ,there is sub-node as follow:
<record id="Lotus Europa">        30.4   4  95.1 113 3.77 1.513 16.90  1  1    5    2</record>
I want to get the specific sub-node according to the attribute "id="Lotus Europa".
Is there a simple function in the xml package?


--
何亮
中国科学院大学 地理科学与资源研究所 陆地水循环与地表过程重点实验室
北京市 朝阳区 大屯路甲11号
电话：13651318417
Liang He
Institute of Geographic Sciences and Natural resource research
Chinese Academy of Science,
No.11, Datun Road, Chaoyang District,
Beijing 100101, China
Email: xhl860728@163.com
Tel: +86(10) 6488 9513
Mob:+86 0 13651318417






	[[alternative HTML version deleted]]

