2002-07-26 Tim Coleman <tim@timcoleman.com>
[mono.git] / mcs / class / System.XML / System.Xml / XmlCharacterData.cs
index 12cfa99181cf7b4297e0cd3853ff9cbc6ee181d1..bdd3612bb6cd33629dcb4900cc3ffc8734646436 100644 (file)
@@ -20,6 +20,9 @@ namespace System.Xml
                protected internal XmlCharacterData (string data, XmlDocument doc)
                        : base (doc)
                {
+                       if (data == null)
+                               data = String.Empty;
+
                        this.data = data;
                }
 
@@ -33,27 +36,25 @@ namespace System.Xml
                        set { data = value; }
                }
 
-               [MonoTODO]
                public override string InnerText {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+                       get { return data; }
 
-                       set {
-                               throw new NotImplementedException ();
-                       }
+                       set { data = value; }
                }
 
-               public int Length {
-                       get {
-                               return data != null ? data.Length : 0;
-                       }
+               public virtual int Length {
+                       get { return data != null ? data.Length : 0; }
                }
 
                public override string Value {
                        get { return data; }
 
-                       set { data = value; }
+                       set {
+                               if (IsReadOnly)
+                                       throw new ArgumentException ("Node is read-only.");
+
+                               data = value;
+                       }
                }
 
                #endregion
@@ -84,10 +85,9 @@ namespace System.Xml
                        throw new NotImplementedException();
                }
 
-               [MonoTODO]
-               public virtual string Substring(int offset, int count)
+               public virtual string Substring (int offset, int count)
                {
-                       throw new NotImplementedException();
+                       return data.Substring (offset, count);
                }
 
                #endregion