internal IEnumerable <TraceXPathNavigator.ElementNode> FindSubnodes(string[] headersPath) { TraceXPathNavigator.ElementNode elementNode; if (headersPath == null) { throw new ArgumentNullException("headersPath"); } TraceXPathNavigator.ElementNode elementNode1 = this; if (string.CompareOrdinal(elementNode1.name, headersPath[0]) != 0) { elementNode1 = null; } int num = 0; while (elementNode1 != null) { int num1 = num + 1; int num2 = num1; num = num1; if (num2 >= (int)headersPath.Length) { break; } TraceXPathNavigator.ElementNode elementNode2 = null; if (elementNode1.childNodes != null) { List <TraceXPathNavigator.TraceNode> .Enumerator enumerator = elementNode1.childNodes.GetEnumerator(); try { while (enumerator.MoveNext()) { TraceXPathNavigator.TraceNode current = enumerator.Current; if (current.NodeType != XPathNodeType.Element) { continue; } elementNode = current as TraceXPathNavigator.ElementNode; if (elementNode == null || string.CompareOrdinal(elementNode.name, headersPath[num]) != 0) { continue; } if ((int)headersPath.Length != num + 1) { goto Label0; } yield return(elementNode); } goto Label1; Label0: elementNode2 = elementNode; } finally { ((IDisposable)enumerator).Dispose(); } } Label1: elementNode1 = elementNode2; } }
private string LookupPrefix(string ns, TraceXPathNavigator.ElementNode node) { string str = null; if (string.Compare(ns, node.xmlns, StringComparison.Ordinal) != 0) { foreach (TraceXPathNavigator.AttributeNode attribute in node.attributes) { if (string.Compare("xmlns", attribute.prefix, StringComparison.Ordinal) != 0 || string.Compare(ns, attribute.nodeValue, StringComparison.Ordinal) != 0) { continue; } str = attribute.name; break; } } else { str = node.prefix; } if (string.IsNullOrEmpty(str) && node.parent != null) { str = this.LookupPrefix(ns, node.parent); } return(str); }
public override bool MoveToNext() { if (this.current == null) { throw new InvalidOperationException(); } bool flag = false; if (this.state != XPathNodeType.Text) { TraceXPathNavigator.ElementNode elementNode = this.current.parent; if (elementNode != null) { TraceXPathNavigator.TraceNode next = elementNode.MoveToNext(); if (next == null && elementNode.text != null && !elementNode.movedToText) { this.state = XPathNodeType.Text; elementNode.movedToText = true; this.current = elementNode; flag = true; } else if (next != null) { this.state = next.NodeType; flag = true; this.current = next; } } } return(flag); }
private static void MaskElement(TraceXPathNavigator.ElementNode element) { if (element != null) { element.childNodes.Clear(); element.Add(new TraceXPathNavigator.CommentNode("Removed", element)); element.text = null; element.attributes = null; } }
internal TraceXPathNavigator.TraceNode MoveToNext() { TraceXPathNavigator.TraceNode item = null; if (this.elementIndex + 1 < this.childNodes.Count) { TraceXPathNavigator.ElementNode elementNode = this; elementNode.elementIndex = elementNode.elementIndex + 1; item = this.childNodes[this.elementIndex]; } return(item); }
internal bool MoveToNextAttribute() { bool flag = false; if (this.attributeIndex + 1 < this.attributes.Count) { TraceXPathNavigator.ElementNode elementNode = this; elementNode.attributeIndex = elementNode.attributeIndex + 1; flag = true; } return(flag); }
internal void AddElement(string prefix, string name, string xmlns) { if (this.closed) { throw new InvalidOperationException(); } TraceXPathNavigator.ElementNode elementNode = new TraceXPathNavigator.ElementNode(name, prefix, this.CurrentElement, xmlns); if (this.current == null) { this.VerifySize(elementNode); this.root = elementNode; this.current = this.root; return; } if (!this.closed) { this.VerifySize(elementNode); this.CurrentElement.Add(elementNode); this.current = elementNode; } }
internal void Reset() { this.attributeIndex = 0; this.elementIndex = 0; this.movedToText = false; if (this.childNodes != null) { foreach (TraceXPathNavigator.TraceNode childNode in this.childNodes) { if (childNode.NodeType != XPathNodeType.Element) { continue; } TraceXPathNavigator.ElementNode elementNode = childNode as TraceXPathNavigator.ElementNode; if (elementNode == null) { continue; } elementNode.Reset(); } } }
private static void MaskSubnodes(TraceXPathNavigator.ElementNode element, string[] elementNames, bool processNodeItself) { if (elementNames == null) { throw new ArgumentNullException("elementNames"); } if (element != null) { bool flag = true; if (processNodeItself) { string[] strArrays = elementNames; int num = 0; while (num < (int)strArrays.Length) { if (string.CompareOrdinal(strArrays[num], element.name) != 0) { num++; } else { TraceXPathNavigator.MaskElement(element); flag = false; break; } } } if (flag && element.childNodes != null) { foreach (TraceXPathNavigator.ElementNode childNode in element.childNodes) { TraceXPathNavigator.MaskSubnodes(childNode, elementNames, true); } } } }
internal ProcessingInstructionNode(string name, string text, TraceXPathNavigator.ElementNode parent) : base(XPathNodeType.ProcessingInstruction, parent) { this.name = name; this.text = text; }
internal ElementNode(string name, string prefix, TraceXPathNavigator.ElementNode parent, string xmlns) : base(XPathNodeType.Element, parent) { this.name = name; this.prefix = prefix; this.xmlns = xmlns; }
internal CommentNode(string nodeValue, TraceXPathNavigator.ElementNode parent) : base(XPathNodeType.Comment, parent) { this.nodeValue = nodeValue; }
private static void MaskSubnodes(TraceXPathNavigator.ElementNode element, string[] elementNames) { TraceXPathNavigator.MaskSubnodes(element, elementNames, false); }
protected TraceNode(XPathNodeType nodeType, TraceXPathNavigator.ElementNode parent) { this.nodeType = nodeType; this.parent = parent; }