Retrive value from xml

Hi all,

i want to retrive some values from a XML,here is the XML

<?xml version="1.0"?>
<transforms>
  <Happy>
    <FacePosition>
      <x>7</x>
      <y>8</y>
      <z>9</z>
    </FacePosition>
    <FaceRotation>
      <x>1</x>
      <y>2</y>
      <z>3</z>
    </FaceRotation>
    <EyeRotation>
      <x>4</x>
      <y>5</y>
      <z>6</z>
    </EyeRotation>
  </Happy>
  <nervous>
    <FacePosition>
      <x>1</x>
      <y>2</y>
      <z>3</z>
    </FacePosition>
    <FaceRotation>
      <x>4</x>
      <y>5</y>
      <z>6</z>
    </FaceRotation>
    <EyeRotation>
      <x>7</x>
      <y>8</y>
      <z>9</z>
    </EyeRotation>
  </nervous>
</transforms>

Here’s the method to retrive the values

public static Vector3 LoadFromXml(string elementName,string typename)
	{
		float X = 0;
		float Y = 0;
		float Z = 0;
		
		string filepath = Application.dataPath + @"/Resources/Data.xml";
		//string filepath = Resources.Load("Data");
		
		XmlDocument xmlDoc = new XmlDocument(); 
		
		if(File.Exists (filepath))
		{
			xmlDoc.Load(filepath); 
				
			XmlNodeList transformList = xmlDoc.GetElementsByTagName(elementName);
		
			foreach (XmlNode transformInfo in transformList)
			{
				XmlNodeList transformcontent = transformInfo.ChildNodes;
				
				foreach (XmlNode transformItens in transformcontent) 
				{
					if(transformItens.Name == "x")
					{
							X = float.Parse(transformItens.InnerText); // convert the strings to float and apply to the Y variable.
					}
					if(transformItens.Name == "y")
					{
							 Y = float.Parse(transformItens.InnerText); // convert the strings to float and apply to the Y variable.
					}
					if(transformItens.Name == "z")
					{
							Z = float.Parse(transformItens.InnerText); // convert the strings to float and apply to the Y variable.
					}
				}
			}
		
		}
		return new Vector3(X,Y,Z);;
	}

here element name is the name of the state which could be happy or nervous and type name is the name of the sub element facerotation or faceposition or eye rotation.i want to retrive coordinates for a specific state and its subelement.

please help me out i am completely new to XML

solved myself

heres the solution

public static Vector3 LoadFromXml(string elementName,string typename,int stage)
{
	float X = 0;
	float Y = 0;
	float Z = 0;
	string p1 = "x";
	string p2 = "y";
	string p3 = "z";

	string filepath = Application.dataPath + @"/Resources/Data.xml";
	//string filepath = Resources.Load("Data");
	
	XmlDocument xmlDoc = new XmlDocument(); 
	
	if(File.Exists (filepath))
	{
		xmlDoc.Load(filepath); 
			
		XmlNodeList transformList = xmlDoc.GetElementsByTagName(elementName);
	
		foreach (XmlNode transformInfo in transformList)
		{
			XmlNodeList transformcontent = transformInfo.ChildNodes;
			
			foreach (XmlNode transformItens in transformcontent) 
			{
				if(transformItens.Name == typename)
				{
					XmlNodeList newtransformList = transformItens.ChildNodes;
						
						foreach (XmlNode newtransformItens in newtransformList)
						{
								if(newtransformItens.Name == "x")
								{
										X = float.Parse(newtransformItens.InnerText); // convert the strings to float and apply to the Y variable.
								}
								if(newtransformItens.Name == "y")
								{
										 Y = float.Parse(newtransformItens.InnerText); // convert the strings to float and apply to the Y variable.
								}
								if(newtransformItens.Name == "z")
								{
										Z = float.Parse(newtransformItens.InnerText); // convert the strings to float and apply to the Y variable.
								}
						} 
				}
			}
		}
	
	}
	return new Vector3(X,Y,Z);;
}