public Expression CreateExpressionFor(XmlNode node) { List <LocationStep> steps = new List <LocationStep>(); XmlNode current = node; while (current != null) { steps.Insert(0, new LocationStep(AxisSpecifier.Descendant, NodeTest.Create(""))); current = current.ParentNode; } return(null); }
public LocationStep(string exp) { if (exp.IndexOf("::") > 0) { int start = exp.IndexOf("::"); string axisSpec = exp.Substring(0, start); exp = exp.Substring(start + 2); this._axis = AxisSpecifier.Find(axisSpec); } else { if (exp[0] == '@') { this._axis = AxisSpecifier.Attribute; exp = exp.Substring(1); } else if (exp.Length >= 2 && exp.Substring(0, 2).Equals("..")) { this._axis = AxisSpecifier.Parent; } else if (exp[0] == '.') { this._axis = AxisSpecifier.Self; } else { this._axis = AxisSpecifier.Child; } } this._predicates = new List <Predicate>(); MatchCollection matches = predicateMatcher.Matches(exp); if (matches.Count > 0) { foreach (Match match in matches) { this._predicates.Add(new Predicate(match.Value)); } exp = exp.Substring(0, matches[0].Index); } if (this._axis == AxisSpecifier.Parent) { this._nodeTest = NodeTest.Create("*"); } else { this._nodeTest = NodeTest.Create(exp); } }
/// <summary> /// Creates a new Location Step for a provided axis type and node test /// </summary> /// <param name="axis"></param> /// <param name="nodeTest"></param> public LocationStep(AxisSpecifier axis, NodeTest nodeTest) { this._axis = axis; this._nodeTest = nodeTest; this._predicates = new List <Predicate>(); }