I tried looking this up on here but couldnt find a proper answer. I have a XML string which has a bunch of nodes.
I want to extract only a couple of nodes from this string and append it with a new root element and return it.
I know how to do this by loading this onto an XMLDocument and selecting nodes. Is there a better way of doing this using an XpathNavigator or XmlReader?
This is my String
<root>
<node1/>
<node2/>
<node3/>
<node4/>
<node5>
</root>
I want my output string to be
<root>
<node3/>
<node4/>
</root>
Has to be done in an efficient manner.