获取XML里指定的节点内容信息
1 HttpContent bw = new StringContent(StrXml, Encoding.UTF8, "application/Xml"); 2 var Msg = await _httpClientFactory.CreateClient().PostAsync("http://xxxxx/api/kpbusiness", bw); 3 var ss = Msg.Content.ReadAsStringAsync(); 4 StringReader Reader = new StringReader(ss.Result); 5 XmlDocument xmlDoc = new XmlDocument(); 6 xmlDoc.Load(Reader); 7 XmlNodeList topM = xmlDoc.SelectNodes("//business"); 8 string returncode; 9 string returnmsg; 10 string retappid; 11 string retid; 12 foreach (XmlElement element in topM) 13 { 14 returncode = element.GetElementsByTagName("returncode")[0].InnerText; 15 returnmsg = element.GetElementsByTagName("returnmsg")[0].InnerText; 16 retappid = element.GetElementsByTagName("returncode")[0].InnerText; 17 retid = element.GetElementsByTagName("returncode")[0].InnerText; 18 }
人各有命,上天注定,有人天生为王,有人落草为寇。脚下的路,如果不是你自己的选择,那么旅程的终点在哪,也没人知道。你会走到哪,会遇到谁,都不一定。