r - XML elements to list XML objects -


how split xml tree list of xml objects , user function getnodeset return value should include 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//*") 

i think nodes returned getnodeset pointers underlying xml object, instance

> special_nodes[[1]] <name>abc</name>  > xpathsapply(special_nodes[[1]], "../cost") [[1]] <cost>3.54</cost>  

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -