2011/02/27(Sun) 23:46:09 編集(投稿者)
■No57450 (上条 さん) に返信
各行に分解しないで、こんな感じでどう?
            var Src = "<thread resultcode=\"0\" thread=\"1074256157\" />\n" +
                    "<chat thread=\"1074256157\" no=\"1\" vpos=\"4370\">1番目</chat>\n" +
                    "<chat thread=\"1074256157\" no=\"2\" vpos=\"6917\">2番目</chat>\n" +
                    "<chat thread=\"074256157\" no=\"3\" vpos=\"26877\">3番目</chat>\n" +
                    "<chat thread=\"074256157\" no=\"4\" vpos=\"30771\">4番目</chat>";
            var xdoc = new XmlDocument();
            //--- Rootは一つの為<roor></root>でくくる
            xdoc.LoadXml(String.Format("<root>{0}</root>", Src));
            foreach (XmlNode ndTmp in xdoc.ChildNodes)
            {
                foreach (XmlNode nd in ndTmp.ChildNodes)
                {
                    var attr = nd.Attributes;
                    if (nd.Name == "chat")
                    {
                        Console.WriteLine(String.Format("{0}:{1}:{2}", nd.Name, attr["thread"].Value, nd.InnerText));
                    }
                }
            }