I have an xml document like this
<MasterDataSet xmlns="http://tempuri.org/MasterDataSet.xsd">
<t_attribute>
<class_id>2</class_id>
<description>Latitude</description>
</t_attribute>
<t_object>
<name>Ship</name>
</t_object>
...
</MasterDataSet>
With many "t_attribute" and "t_object" nodes. I want to get a node set of all the "t_object" nodes so I use getNodeSet with xPath:
library("XML")
emtree0 <- xmlParse("EM0.xml", useInternalNodes = TRUE)
onlyobjects <- getNodeSet(emtree0,"/MasterDataSet//t_object")
But this returns an empty list.
However if I modify the XML file to look like this, i.e. if I remove the xmlns attribute, it works perfectly:
<MasterDataSet>
<t_attribute>
...
Any suggestions to make the code work without having to remove the xmlns attribute?