touchups on XmlTextWriter attribute writing.
[mono.git] / mcs / class / System.XML / System.Xml / XmlException.cs
index 8ba136670103989ede23ccc2007e36f58fa4cba5..a9e291fbe93931f9a4c36733b216560770687358 100755 (executable)
@@ -12,10 +12,12 @@ using System.Runtime.Serialization;
 
 namespace System.Xml
 {
+       [Serializable]
        public class XmlException : SystemException
        {
                #region Fields
 
+               string msg;     //  Cache message here because SystemException doesn't expose it
                int lineNumber;
                int linePosition;
 
@@ -26,16 +28,19 @@ namespace System.Xml
                public XmlException (string message, Exception innerException) 
                        : base (message, innerException)
                {
+                       msg = message;
                }
 
-               [MonoTODO]
                protected XmlException (SerializationInfo info, StreamingContext context)
                {
-                       throw new NotImplementedException ();
+                       this.lineNumber = info.GetInt32 ("lineNumber");
+                       this.linePosition = info.GetInt32 ("linePosition");
                }
 
-               internal XmlException (string message) : base (message)
+               internal XmlException (string message)
+                       : base (message)
                {
+                       msg = message;
                }
 
                internal XmlException (string message, int lineNumber, int linePosition) : base (message)
@@ -44,24 +49,33 @@ namespace System.Xml
                        this.linePosition = linePosition;
                }
 
-               internal XmlException (string message, XmlInputSource inputSrc)
-               {
-               }
-
                #endregion
 
                #region Properties
 
-               public int LineNumber 
-               {
+               public int LineNumber {
                        get { return lineNumber; }
                }
 
-               public int LinePosition 
-               {
+               public int LinePosition {
                        get { return linePosition; }
                }
 
+               public override string Message {
+                       get { return msg; }
+               }
+
+               #endregion
+
+               #region Methods
+
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+                       info.AddValue ("lineNumber", lineNumber);
+                       info.AddValue ("linePosition", linePosition);
+               }
+
                #endregion
        }
 }