Ejemplo n.º 1
0
        public override bool MoveToNext(XPathNodeType type)
        {
            XNode currentNode = _source as XNode;

            if (currentNode != null)
            {
                XContainer container = currentNode.GetParent();
                if (container != null)
                {
                    int mask = GetElementContentMask(type);
                    if ((TextMask & mask) != 0 && container.GetParent() == null && container is XDocument)
                    {
                        mask &= ~TextMask;
                    }
                    XNode next = null;
                    for (XNode node = currentNode; node != null; node = next)
                    {
                        next = node.NextNode;
                        if (((1 << (int)next.NodeType) & mask) != 0 && !(node is XText && next is XText))
                        {
                            _source = next;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
        public override bool MoveToPrevious()
        {
            XNode currentNode = _source as XNode;

            if (currentNode != null)
            {
                XContainer container = currentNode.GetParent();
                if (container != null)
                {
                    XNode previous = null;
                    foreach (XNode node in container.Nodes())
                    {
                        if (node == currentNode)
                        {
                            if (previous != null)
                            {
                                _source = previous;
                                return(true);
                            }
                            return(false);
                        }

                        if (IsContent(container, node))
                        {
                            previous = node;
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        public override bool MoveToNext()
        {
            XNode currentNode = _source as XNode;

            if (currentNode != null)
            {
                XContainer container = currentNode.GetParent();
                if (container != null)
                {
                    XNode next = null;
                    for (XNode node = currentNode; node != null; node = next)
                    {
                        next = node.NextNode;
                        if (next == null)
                        {
                            break;
                        }
                        if (IsContent(container, next) && !(node is XText && next is XText))
                        {
                            _source = next;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 4
0
        public override bool MoveToPrevious()
        {
            XNode n = source as XNode;

            if (n != null)
            {
                XContainer c = n.GetParent();
                if (c != null)
                {
                    XNode q = c.LastNode;
                    if (q.NextNode != n)
                    {
                        XNode p = null;
                        do
                        {
                            q = q.NextNode;
                            if (IsContent(c, q))
                            {
                                p = p is XText && q is XText ? p : q;
                            }
                        } while (q.NextNode != n);
                        if (p != null)
                        {
                            source = p;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 5
0
        public override bool MoveToNext(XPathNodeType type)
        {
            XNode n = source as XNode;

            if (n != null)
            {
                XContainer c = n.GetParent();
                if (c != null)
                {
                    XNode content = c.LastNode;
                    int   mask    = GetElementContentMask(type);
                    if ((TextMask & mask) != 0 && c.GetParent() == null && c is XDocument)
                    {
                        mask &= ~TextMask;
                    }
                    while (n != content)
                    {
                        XNode next = n.NextNode;
                        if (((1 << (int)next.NodeType) & mask) != 0 && !(n is XText && next is XText))
                        {
                            source = next;
                            return(true);
                        }
                        n = next;
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 6
0
        public override bool MoveToNext(string localName, string namespaceName)
        {
            XNode n = source as XNode;

            if (n != null)
            {
                XContainer c = n.GetParent();
                if (c != null)
                {
                    XNode content = c.LastNode;
                    while (n != content)
                    {
                        n = n.NextNode;
                        XElement e = n as XElement;
                        if (e != null &&
                            e.Name.LocalName == localName &&
                            e.Name.NamespaceName == namespaceName)
                        {
                            source = e;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 7
0
        public override bool MoveToNext()
        {
            XNode n = source as XNode;

            if (n != null)
            {
                XContainer c = n.GetParent();
                if (c != null)
                {
                    XNode content = c.LastNode;
                    while (n != content)
                    {
                        XNode next = n.NextNode;
                        if (IsContent(c, next) && !(n is XText && next is XText))
                        {
                            source = next;
                            return(true);
                        }
                        n = next;
                    }
                }
            }
            return(false);
        }