private static List<xpathProp> dismantle(string xpath) { String[] xpathArray = xpath.Split('/'); List<xpathProp> xpathDict = new List<xpathProp>(); foreach (string s in xpathArray) { xpathProp xp = new xpathProp(); if (s.Length > 0) { xp.nodeName = s.Substring(0, s.IndexOf('[')); string subs = s.Substring(s.IndexOf('[') + 1, s.IndexOf(']') - s.IndexOf('[') - 1); xp.nodeIndex = long.Parse(subs); } else { xp.nodeName = s; xp.nodeIndex = 1; } xpathDict.Add(xp); } return xpathDict; }