/* { * get * { * string tempPath = ""; * string[] parts = XPath.Split('/'); * * string part1 = parts[2]; * * if (part1.StartsWith(@"*[name()='")) * { * string a = part1.Replace(@"//*[name()='", ""); * string b = a.Replace("']", ""); * part1 = "//*[local-name()='" + b.Split(':').ElementAt(1) + "']"; * * * } * * for (int i = 3; i < parts.Length; i++) * { * * string[] currentParts = parts[i].Split(':'); * if (currentParts.Length > 1) * { * tempPath += "/" + currentParts[1]; * } * else * { * tempPath += "/" + parts[i]; * } * * } * * return part1 + tempPath; * }*/ #endregion #region Constructors private JsonExtended(JsonExtended Parent, JToken Node) { ParentNode = Parent; JT = Node; BuildThisNode(JT.Children()); }
private void BuildThisNode(JEnumerable <JToken> JTl) { foreach (JToken XN in JTl) { JsonExtended childJsonExtended = new JsonExtended(this, XN); ChildNodes.Add(childJsonExtended); } }
public JsonExtended(string json) { JT = JToken.Parse(json); ParentNode = null; // XPath = Node.Name; JEnumerable<JToken> childList = JT.Children(); BuildThisNode(childList); }
public JsonExtended(string json) { JToken XD = JToken.Parse(json); ParentNode = null; // XPath = Node.Name; JT = XD; BuildThisNode(JT.Children()); }
/* { * get * { * string tempPath = ""; * string[] parts = XPath.Split('/'); * * string part1 = parts[2]; * * if (part1.StartsWith(@"*[name()='")) * { * string a = part1.Replace(@"//*[name()='", ""); * string b = a.Replace("']", ""); * part1 = "//*[local-name()='" + b.Split(':').ElementAt(1) + "']"; * * * } * * for (int i = 3; i < parts.Length; i++) * { * * string[] currentParts = parts[i].Split(':'); * if (currentParts.Length > 1) * { * tempPath += "/" + currentParts[1]; * } * else * { * tempPath += "/" + parts[i]; * } * * } * * return part1 + tempPath; * }*/ #endregion #region Constructors private JsonExtended(JsonExtended Parent, JToken Node) { ParentNode = Parent; JT = Node; JEnumerable <JToken> childList = JT.Children(); BuildThisNode(childList); }