private static XmlObjectNode GetUserVariableObject(XmlUserVariableReference xmlUserVariableReference, string reference)
{
XElement currentElement = xmlUserVariableReference._xRoot;
string[] array = reference.Split(new char[] { '/'}, StringSplitOptions.RemoveEmptyEntries);
var matchQuery = from word in array
where word.ToLowerInvariant() == ".."
select word;
int stepsDown = matchQuery.Count();
for(int i=0; i < stepsDown; i++)
{
currentElement = currentElement.Parent;
}
for(int i=stepsDown; i<array.Length; i++)
{
//TODO: throws exception
string type = array[i].Split('[')[0];
int number = GetElementNumber(array[i]);
currentElement = currentElement.Elements(type).ElementAt(number);
}
return new XmlUserVariable(currentElement);
}