I am currently trying to get some XML data and rework it into another format for a project I am working on. Now I am able to get the childnodes of what I am doing, but I can't seem to get it to split the child nodes up. This is the XML data I am getting.

```
<Race xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Checkpoints>
    <Vector3>
       <X>237.477936</X>
       <Y>936.0487</Y>
       <Z>209.590744</Z>
    </Vector3>
    <Vector3>
       <X>163.06778</X>
       <Y>922.664856</Y>
       <Z>208.251434</Z>
    </Vector3>
    <Vector3>
       <X>74.3054</X>
       <Y>1022.99408</Y>
       <Z>215.625259</Z>
    </Vector3>
    <Vector3>
       <X>20.2580948</X>
       <Y>1040.94922</Y>
       <Z>217.798935</Z>
    </Vector3>
</Checkpoints>
</Race>

```

No I am trying to grab the X, Y and Z of each vector and construct them into a table like the following,

```
{X, Y, Z, 8.0}

```

I am currently doing this 

```
            XmlNodeList checkNodes = doc.SelectNodes("/Race/Checkpoints");

                foreach (XmlNode aNode in checkNodes)
                {
                    for (var w = 0; w < aNode.ChildNodes.Count; w++)
                    {
                        string checkpoint = "";

                        string xPos = aNode.ChildNodes[w].InnerText.ToString();
                        string yPos = aNode.ChildNodes[w].InnerText.ToString();
                        string zPos = aNode.ChildNodes[w].InnerText.ToString();

                        checkpoint = "{" + xPos + ", " + yPos + ", " + zPos + ", 8.0},";
                        xnTextBox.AppendText(Environment.NewLine + checkpoint);
                    }
                }

```

But I am not able to break down individual child components, it will only output all of them like so

```
{237.477936936.0487209.590744, 237.477936936.0487209.590744, 237.477936936.0487209.590744, 8.0},
{163.06778922.664856208.251434, 163.06778922.664856208.251434, 163.06778922.664856208.251434, 8.0},
{74.30541022.99408215.625259, 74.30541022.99408215.625259, 74.30541022.99408215.625259, 8.0},

```

and yeah I know that yPos and zPos are outputting the same as zPos thats because I cant work out how to split the childnodes. Any help would be great, Thankyou.

**Edit:**

I have created the answer below into a class and it works, but now I have a further nested element I need to get but when I try to add it, it only returns one row and not the heading.

This is the class

```
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;

[XmlRoot("Race")]
public class Race
{
    [XmlElement(ElementName = "Checkpoints")]
    public Checkpoints Checkpoints { get; set; }
    [XmlElement(ElementName = "SpawnPoints")]
    public SpawnPoints SpawnPoints { get; set; }
}

[XmlRoot("Vector3")]
public class Checkpoints
{
    [XmlElement(ElementName = "Vector3")]
    public List<Vector3> Vectors { get; set; }
}

[XmlRoot("Vector3")]
public class Vector3
{
    [XmlElement(ElementName = "X")]
    public double X { get; set; }

    [XmlElement(ElementName = "Y")]
    public double Y { get; set; }

    [XmlElement(ElementName = "Z")]
    public double Z { get; set; }
}

[XmlRoot("SpawnPoints")]
public class SpawnPoints
{
    [XmlElement(ElementName = "SpawnPoint")]
    public SpawnPoint SpawnPoint { get; set; }
}

[XmlRoot("Position")]
public class SpawnPoint
{
    [XmlElement(ElementName = "Position")]
    public List<Position> Positions { get; set; }
}

[XmlRoot("Position")]
public class Position
{
    [XmlElement(ElementName = "X")]
    public double X { get; set; }

    [XmlElement(ElementName = "Y")]
    public double Y { get; set; }

    [XmlElement(ElementName = "Z")]
    public double Z { get; set; }
}

```

and this is the XML data I am trying to retrieve. I need to get the X, Y, Z and the heading.

```
<Race>
<SpawnPoints>
<SpawnPoint>
  <Position>
    <X>272.181335</X>
    <Y>953.0988</Y>
    <Z>211.16713</Z>
  </Position>
  <Heading>124.781677</Heading>
</SpawnPoint>
<SpawnPoint>
  <Position>
    <X>271.212</X>
    <Y>957.0102</Y>
    <Z>211.007156</Z>
  </Position>
  <Heading>121.86322</Heading>
</SpawnPoint>
<SpawnPoint>
  <Position>
    <X>270.4751</X>
    <Y>961.3033</Y>
    <Z>210.899719</Z>
  </Position>
  <Heading>118.801186</Heading>
</SpawnPoint>
<SpawnPoint>
  <Position>
    <X>270.059875</X>
    <Y>965.9859</Y>
    <Z>210.793045</Z>
  </Position>
  <Heading>106.5283</Heading>
</SpawnPoint>
<SpawnPoint>
  <Position>
    <X>269.029266</X>
    <Y>970.9914</Y>
    <Z>210.521118</Z>
  </Position>
  <Heading>107.501411</Heading>
</SpawnPoint>
<SpawnPoint>
</Race>

```