public override bool MoveToFirstAttribute()
        {
            var attributes = new CachedEnumerable <IXPathAttribute>(_sourceElementNode.Element.GetAttributes());

            if (attributes.ReadUntil(0))
            {
                _sourceAttributeNode = new AnyAttributeNode(attributes, 0);
                _nodeType            = XPathNodeType.Attribute;
                return(true);
            }

            return(false);
        }
        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);
        }
示例#3
0
 public AnyTreeXPathNodeList(XPathNodeIterator nodeIterator)
 {
     _nodeIterator = nodeIterator;
     _list         = new CachedEnumerable <AnyTreeXPathNavigator>(nodeIterator.Cast <AnyTreeXPathNavigator>());
 }