日期:2014-05-18 浏览次数:20801 次
<?xml version="1.0" encoding="utf-8"?> <xml> <0>12345678901</0> </xml>
String address = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\phone.xml"; try { XmlDocument mydom = new XmlDocument(); mydom.Load(address); XmlElement root = mydom.DocumentElement; XmlNodeList setnode = root.GetElementsByTagName("phone"); if (setnode.Count > 0) { return setnode[0].InnerText; } } catch (Exception ee) { }
string strTemp = "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml><0>12345678901</0><0>58467</0></xml>"; string strReg = @"<0>([^<]+)</0>"; Regex reg = new Regex(strReg); MatchCollection mc = reg.Matches(strTemp); foreach (Match m in mc) { string strV = m.Groups[1].Value; }
------解决方案--------------------
牛人呀
------解决方案--------------------
建议重写XML吧