public bool MoveToNext()
        {
            var scan = _current.NextChild();

            // Make this into a "move to the next child that's an element or attribute"
            while (scan != null)
            {
                if (scan.NodeType == XmlNodeType.Element || (scan.NodeType == XmlNodeType.Attribute && !isReservedAttribute((XAttribute)scan)))
                {
                    var currentName = Name;

                    _current = scan;

                    if (currentName == Name)
                    {
                        _nameIndex += 1;
                    }
                    else
                    {
                        _nameIndex = 0;
                    }

                    return(true);
                }

                scan = scan.NextChild();
            }

            return(false);
        }
Ejemplo n.º 2
0
        private XObject nextMatch (XObject root, string name, XObject startAfter = null)
        {
            var scan = startAfter == null ? root.FirstChild() : startAfter.NextChild();
        
            while(scan != null)
            {
                XName scanName;

                if (scan.NodeType == XmlNodeType.Element && scan is XElement element)
                    scanName = element.Name;
                else if (scan.NodeType == XmlNodeType.Attribute && scan is XAttribute attr && !isReservedAttribute(attr))
                    scanName = attr.Name;
        public bool MoveToNext()
        {
            var scan = _current.NextChild();

            // Make this into a "move to the next child that's an element or attribute"
            while (scan != null)
            {
                if (scan.NodeType == XmlNodeType.Element || scan.NodeType == XmlNodeType.Attribute)
                {
                    _current = scan;
                    return(true);
                }

                scan = scan.NextChild();
            }

            return(false);
        }