In Below program only first <title> is getting modified
I want to update all the occurrences of title how to do this ?
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice 1</title>" +
"<title>Pride And Prejudice 2</title>" +
"<title>Pride And Prejudice 3</title>" +
"<title>Pride And Prejudice 4</title>" +
"</book>");
XPathNavigator navigator = doc.CreateNavigator();
XPathNodeIterator nodes =
navigator.Select("book/title");
foreach (XPathNavigator item in nodes)
{
item.ReplaceSelf("<title>New Data</title>");
}
}
}