1

How could I validate if object is a node of a xml object, I mean how could I check if list[[1]] is of type xml node.

txt = "<data>
       <elements>
         <elem id=\"a\" name=\"abc\"/>
         <elem id=\"a\" name=\"abc\"/>
       </elements>
       </data>"

tree <- xmlTreeParse(txt, useInternalNodes = TRUE)
list <- xpathSApply(tree, "//elements")
Klaus
  • 1,946
  • 3
  • 19
  • 34
  • Do you need something more than class(list[[1]])? – zero323 Sep 10 '13 at 12:08
  • I am not sure, this returns sometimes differnt character vectors one of them is `[1] "XMLInternalElementNode" "XMLInternalNode" "XMLAbstractNode"` – Klaus Sep 10 '13 at 12:10
  • This clearly needs to be linked to the alltime best SO answer at http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – Carl Witthoft Sep 10 '13 at 13:03

0 Answers0