See the question and my original answer on StackOverflow

You could do something like this:

XmlDocument doc = new XmlDocument();
doc.LoadXml("<root " + yourString + "/>");

foreach(XmlAttribute att in doc.DocumentElement)
{
  // ... use att.Name & att.Value here
}

The drawback is it will not work if your string is not good xml. So you'll have to try if it really works for you. For example, "1212" is not a valid Xml attribute name...