System.Xml.Xsl.Qil.QilReplaceVisitor.VisitChildren C# (CSharp) Method

VisitChildren() protected method

Visit all children of "parent", replacing each child with a copy of each child.
protected VisitChildren ( QilNode parent ) : QilNode
parent QilNode
return QilNode
        protected override QilNode VisitChildren(QilNode parent) {
            XmlQueryType oldParentType = parent.XmlType;
            bool recalcType = false;

            // Visit children
            for (int i = 0; i < parent.Count; i++) {
                QilNode oldChild = parent[i], newChild;
                XmlQueryType oldChildType = oldChild != null ? oldChild.XmlType : null;

                // Visit child
                if (IsReference(parent, i))
                    newChild = VisitReference(oldChild);
                else
                    newChild = Visit(oldChild);

                // Only replace child and recalculate type if oldChild != newChild or oldChild.XmlType != newChild.XmlType
                if (!Ref.Equals(oldChild, newChild) || (newChild != null && !Ref.Equals(oldChildType, newChild.XmlType))) {
                    recalcType = true;
                    parent[i] = newChild;
                }
            }

            if (recalcType)
                RecalculateType(parent, oldParentType);

            return parent;
        }