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 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.º 3
0
        public override bool MoveToChild(XPathNodeType type)
        {
            XContainer c = source as XContainer;

            if (c != null)
            {
                XNode content = c.LastNode;
                XNode n       = content;
                if (n != null)
                {
                    int mask = GetElementContentMask(type);
                    if ((TextMask & mask) != 0 && c.GetParent() == null && c is XDocument)
                    {
                        mask &= ~TextMask;
                    }
                    do
                    {
                        n = n.NextNode;
                        if (((1 << (int)n.NodeType) & mask) != 0)
                        {
                            source = n;
                            return(true);
                        }
                    } while (n != content);
                    return(false);
                }
            }
            return(false);
        }
Ejemplo n.º 4
0
 private static bool IsContent(XContainer c, XNode n)
 {
     if (c.GetParent() != null || c is XElement)
     {
         return(true);
     }
     return(((1 << (int)n.NodeType) & DocumentContentMask) != 0);
 }
Ejemplo n.º 5
0
        public override bool MoveToChild(XPathNodeType type)
        {
            XContainer c = _source as XContainer;

            if (c != null)
            {
                int mask = GetElementContentMask(type);
                if ((TextMask & mask) != 0 && c.GetParent() == null && c is XDocument)
                {
                    mask &= ~TextMask;
                }
                foreach (XNode node in c.Nodes())
                {
                    if (((1 << (int)node.NodeType) & mask) != 0)
                    {
                        _source = node;
                        return(true);
                    }
                }
            }
            return(false);
        }