private AnyTreeXPathNavigator(AnyTreeXPathNavigator other) { _sourceElementNode = other._sourceElementNode; _sourceAttributeNode = other._sourceAttributeNode; _nodeType = other._nodeType; _nameTableStub = other._nameTableStub; }
public override bool MoveToParent() { if (_sourceElementNode.Parent != null) { _sourceElementNode = _sourceElementNode.Parent; _nodeType = XPathNodeType.Element; return(true); } return(false); }
private static XPathNodeType GetNodeType(AnyElementNode node) { if (node.Element is TextXPathElement) { return(XPathNodeType.Text); } else { return(XPathNodeType.Element); } }
public override bool MoveToFirstChild() { if (_nodeType == XPathNodeType.Text) { return(false); } var childrenEnumerable = _sourceElementNode.Element.GetChildren(); childrenEnumerable = AppendTextNode(childrenEnumerable, _sourceElementNode); var children = new CachedEnumerable <IXPathElement>(childrenEnumerable); if (children.ReadUntil(0)) { var childNode = new AnyElementNode(_sourceElementNode, children, 0); SetElementNode(childNode); return(true); } return(false); }
private IEnumerable <IXPathElement> AppendTextNode(IEnumerable <IXPathElement> childrenEnumerable, AnyElementNode elementNode) { if (elementNode.Element is ITextProvider) { ITextProvider textProvider = elementNode.Element as ITextProvider; if (textProvider.HasText) { childrenEnumerable = childrenEnumerable.Concat(new[] { new TextXPathElement(textProvider) }); } } return(childrenEnumerable); }
private void SetElementNode(AnyElementNode node) { _sourceElementNode = node; _nodeType = GetNodeType(_sourceElementNode); }
public AnyTreeXPathNavigator(params IXPathElement[] root) { _sourceElementNode = new AnyElementNode(null, new CachedEnumerable <IXPathElement>(root), 0); _nodeType = XPathNodeType.Root; }