diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2004-08-03 15:52:49 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2004-08-03 15:52:49 +0400 |
commit | 0562042171cc2210e8d917e6a657a1c6f8d6479c (patch) | |
tree | 2d8f9b91bd124b01c542ee2989624639e75d2695 /mcs/class/System.XML/System.Xml/XmlCharacterData.cs | |
parent | f01a725db73b849859a64a03b6f18c4d2788a83c (diff) |
2004-08-03 Atsushi Enomoto <atsushi@ximian.com>
* XmlCharacterData.cs,
XmlDocument.cs,
XmlNodeChangedEventArgs.cs :
Implemented XmlNodeChangedEventArgs.OldValue and .NewValue.
svn path=/trunk/mcs/; revision=31791
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlCharacterData.cs')
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlCharacterData.cs | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlCharacterData.cs b/mcs/class/System.XML/System.Xml/XmlCharacterData.cs index c65b46cb872..3623f161131 100644 --- a/mcs/class/System.XML/System.Xml/XmlCharacterData.cs +++ b/mcs/class/System.XML/System.Xml/XmlCharacterData.cs @@ -57,11 +57,12 @@ namespace System.Xml get { return data; } set { - OwnerDocument.onNodeChanging (this, this.ParentNode); + string old = data; + OwnerDocument.onNodeChanging (this, this.ParentNode, old, value); data = value; - OwnerDocument.onNodeChanged (this, this.ParentNode); + OwnerDocument.onNodeChanged (this, this.ParentNode, old, value); } } @@ -93,15 +94,15 @@ namespace System.Xml public virtual void AppendData (string strData) { - OwnerDocument.onNodeChanging (this, this.ParentNode); - data += strData; - OwnerDocument.onNodeChanged (this, this.ParentNode); + string oldData = data; + string newData = data += strData; + OwnerDocument.onNodeChanging (this, this.ParentNode, oldData, newData); + data = newData; + OwnerDocument.onNodeChanged (this, this.ParentNode, oldData, newData); } public virtual void DeleteData (int offset, int count) { - OwnerDocument.onNodeChanging (this, this.ParentNode); - if (offset < 0) throw new ArgumentOutOfRangeException ("offset", "Must be non-negative and must not be greater than the length of this instance."); @@ -110,27 +111,33 @@ namespace System.Xml if ((offset + count) < data.Length) newCount = count; - data = data.Remove (offset, newCount); + string oldValue = data; + string newValue = data.Remove (offset, newCount); + + OwnerDocument.onNodeChanging (this, this.ParentNode, oldValue, newValue); + + data = newValue; - OwnerDocument.onNodeChanged (this, this.ParentNode); + OwnerDocument.onNodeChanged (this, this.ParentNode, oldValue, newValue); } public virtual void InsertData (int offset, string strData) { - OwnerDocument.onNodeChanging (this, this.ParentNode); - if ((offset < 0) || (offset > data.Length)) throw new ArgumentOutOfRangeException ("offset", "Must be non-negative and must not be greater than the length of this instance."); - data = data.Insert(offset, strData); + string oldData = data; + string newData = data.Insert(offset, strData); - OwnerDocument.onNodeChanged (this, this.ParentNode); + OwnerDocument.onNodeChanging (this, this.ParentNode, oldData, newData); + + data = newData; + + OwnerDocument.onNodeChanged (this, this.ParentNode, oldData, newData); } public virtual void ReplaceData (int offset, int count, string strData) { - OwnerDocument.onNodeChanging (this, this.ParentNode); - if ((offset < 0) || (offset > data.Length)) throw new ArgumentOutOfRangeException ("offset", "Must be non-negative and must not be greater than the length of this instance."); @@ -140,14 +147,17 @@ namespace System.Xml if (strData == null) throw new ArgumentNullException ("strData", "Must be non-null."); + string oldData = data; string newData = data.Substring (0, offset) + strData; if ((offset + count) < data.Length) newData += data.Substring (offset + count); + OwnerDocument.onNodeChanging (this, this.ParentNode, oldData, newData); + data = newData; - OwnerDocument.onNodeChanged (this, this.ParentNode); + OwnerDocument.onNodeChanged (this, this.ParentNode, oldData, newData); } public virtual string Substring (int offset, int count) |