Пример #1
0
        internal void AppendChild(XmlNode parent, XmlNode child)
        {
            Insertion ins = new Insertion();

            ins.ParentNode   = parent;
            ins.InsertedNode = child;
            changes.Add(ins);
        }
Пример #2
0
        public void RejectChanges()
        {
            for (int i = changes.Count - 1; i >= 0; i--)
            {
                Insertion ins = changes [i] as Insertion;
                if (ins != null)
                {
                    ins.ParentNode.RemoveChild(ins.InsertedNode);
                    continue;
                }

                Removal rem = changes [i] as Removal;
                if (rem != null)
                {
                    if (rem.RemovedNode.NodeType == XmlNodeType.Attribute)
                    {
                        XmlElement el = (XmlElement)rem.OwnerNode;
                        el.SetAttributeNode((XmlAttribute)rem.RemovedNode);
                    }
                    else
                    {
                        rem.OwnerNode.InsertBefore(rem.RemovedNode, rem.NextSibling);
                    }
                    continue;
                }
                AttributeUpdate au = changes [i] as AttributeUpdate;
                if (au != null)
                {
                    if (au.OldAttribute != null)
                    {
                        au.Element.SetAttributeNode(au.OldAttribute);
                    }
                    else
                    {
                        au.Element.RemoveAttributeNode(au.NewAttribute);
                    }
                    continue;
                }
            }
            changes.Clear();
        }
Пример #3
0
		internal void AppendChild (XmlNode parent, XmlNode child)
		{
			Insertion ins = new Insertion ();
			ins.ParentNode = parent;
			ins.InsertedNode = child;
			changes.Add (ins);
		}