Question: what is the simplest way to parse the lat and long out of the following xml fragment. There is no namespace etc.

It is in a string variable. not a stream.

```
<poi>
      <city>stockholm</city>
      <country>sweden</country>
      <gpoint>
        <lat>51.1</lat>
        <lng>67.98</lng>
      </gpoint>
</poi>

```

everything I have read so far is waaaaay too complex for what should be a simple task
e.g.
[Link](https://web.archive.org/web/20160829021356/http://geekswithblogs.net:80/kobush/archive/2006/04/20/75717.aspx)

I've been looking at the above link

Surely there is a simpler way to do this in .net?

Answer: 
```
using System.IO;
using System.Xml;
using System.Xml.XPath;

```

. . .

```
    string xml = @"<poi>      
                     <city>stockholm</city>  
                     <country>sweden</countr>
                        <gpoint>        
                            <lat>51.1</lat>        
                            <lng>67.98</lng>    
                        </gpoint>
                   </poi>";

    XmlReaderSettings set = new XmlReaderSettings();
    set.ConformanceLevel = ConformanceLevel.Fragment;

    XPathDocument doc = 
        new XPathDocument(XmlReader.Create(new StringReader(xml), set));

    XPathNavigator nav = doc.CreateNavigator();

    Console.WriteLine(nav.SelectSingleNode("/poi/gpoint/lat"));
    Console.WriteLine(nav.SelectSingleNode("/poi/gpoint/lng"));

```

You could of course use xpath `SelectSingleNode` to select the `<gpoint>` element into a variable.
Even simpler than Mitch Wheat's answer, since the fragment in question is a well-formed XML document:

```
using System.Xml;
using System.IO;

...

string xml = @"<poi>
                  <city>stockholm</city>
                  <country>sweden</country>
                  <gpoint>
                    <lat>51.1</lat>
                    <lng>67.98</lng>
                  </gpoint>
              </poi>";

XmlDocument d = new XmlDocument();
d.Load(new StringReader(xml));
Console.WriteLine(d.SelectSingleNode("/poi/gpoint/lat").InnerText);
Console.WriteLine(d.SelectSingleNode("/poi/gpoint/lng").InnerText);

```