a guest Aug 10th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. XmlDocument xmlDoc = new XmlDocument();
  2. string myXML = "<?xml version=\"1.0\" encoding=\"utf-16\"?><myDataz xmlns:xsi=\"\" xmlns:xsd=\"\"><listS><sog><field1>123</field1><field2>a</field2><field3>b</field3></sog><sog><field1>456</field1><field2>c</field2><field3>d</field3></sog></listS></myDataz>"
  3. xmlDoc.Load(myXML);
  4. XmlNodeList parentNode = xmlDoc.GetElementsByTagName("listS");
  5. foreach (XmlNode childrenNode in parentNode)
  6. {
  7.     HttpContext.Current.Response.Write(childrenNode.SelectSingleNode("//field1").Value);
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand