How could I split the XML tree to a list of XML objects and then I like to user the function getNodeSet but the return value should include the root object "part"?
require(XML)
txt = "<doc>
<part>
<name>ABC</name>
<type>XYZ</type>
<cost>3.54</cost>
<status>available</status>
</part>
<part>
<name>ABC</name>
<type>XYZ</type>
<cost>3.54</cost>
<status>available</status>
</part>
</doc>"
doc <- xmlTreeParse(txt, useInternalNodes = TRUE)
special_nodes <- getNodeSet(doc, "/*/part//*")
xpathApply(doc, "//doc/*")but this is not exactly what I am looking for because I dont want to specify the root doc. I want that it founds the tags part under each root.getNodeSet(doc, "//part")