Manipulate XML files in c#
Don't parse it through string manipulation, use the XML libraries in the framework.  I'd recommend LINQ to XML.  Parse it and make your changes.

var xmlStr = @"&lt;root&gt;
&lt;item&gt;asdf&lt;/item&gt;
&lt;item&gt;asdf&lt;/item&gt;
&lt;item&gt;asdf&lt;/item&gt;
&lt;/root&gt;";

var doc = XDocument.Parse(xmlStr);         // parse from string
//var doc = XDocument.Load("arrays2.xml"); // or load from file
var items = doc.Descendants("item");       // find all item elements
var index = 1;
foreach (var item in items.ToList())  // ToList() required since we're modifying the document
{
    var name = "x" + index++;
    var nameAttr = new XAttribute("name", name);           // create the name attribute
    var value = (string)item;                              // read the value as a string
    var newNode = new XElement("string", nameAttr, value); // create the new element
    item.ReplaceWith(newNode);                             // replace the current one
}
//doc.Save("arrays2_formatted.xml"); // save the changes to the file