How to add or give the parent node for set of nodes in xmlDocument using vb.net.
I am having following xml nodes
<books>
<title>title</title>
<isbn>123456</isbn>
<surname>surname</surname>
<givenname>givenname</givenname>
</books>
Now i want to add parent node <author>
for <surname>
and <givenname>
as follows.
<books>
<title>title</title>
<isbn>123456</isbn>
<author>
<surname>surname</surname>
<givenname>givenname</givenname>
</author>
</books>
can any one tell me how to do it in xmlDocument in vb.net.
You need to:
For instance:
You can identify the nodes with a call to
XPathSelectElements
, then remove them from the tree and add them to a newauthor
node.Example: