Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string myXml = "<test><a i=\"1\"/><a i=\"2\"/></a></a></test>";
- System.IO.MemoryStream ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(myXml));
- System.Xml.XmlReader xr = System.Xml.XmlReader.Create(ms);
- int firstIValue = 0;
- while (xr.Read())
- {
- if(xr.NodeType == System.Xml.XmlNodeType.Element)
- if (xr.Name == "a")
- {
- firstIValue = Convert.ToInt32(xr["i"]);
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement