-// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-\r
-//\r
-// System.Xml.XmlException\r
-//\r
-// Author:\r
-// Daniel Weber (daniel-weber@austin.rr.com)\r
-//\r
-// (C) 2001 Daniel Weber\r
-\r
-using System;\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Xml\r
-{\r
- /// <summary>\r
- /// Abstract class XmlNodeList.\r
- /// </summary>\r
- public class XmlException : SystemException\r
- {\r
- // Private data members\r
- int FlineNumber;\r
- int FlinePosition;\r
- string Fmessage;\r
-\r
- // public properties\r
- /// <summary>\r
- /// Get the line number where the exception occured\r
- /// </summary>\r
- public int LineNumber \r
- {\r
- get\r
- {\r
- return FlineNumber;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Get the line position where the exception occured.\r
- /// </summary>\r
- public int LinePosition \r
- {\r
- get\r
- {\r
- return FlinePosition;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Get the error message describing the exception.\r
- /// </summary>\r
- public override string Message \r
- {\r
- get\r
- {\r
- return Fmessage;\r
- }\r
- }\r
-\r
- // Public Methods\r
-\r
- // Constructors\r
- /// <summary>\r
- /// Create a new XmlException object.\r
- /// </summary>\r
- /// <param name="info">The serializatin object holding all exception information.</param>\r
- /// <param name="context">The streaming context containing the context of the error</param>\r
- public XmlException(\r
- SerializationInfo info,\r
- StreamingContext context\r
- )\r
- {\r
- FlineNumber = info.GetInt32("lineNumber");\r
- FlinePosition = info.GetInt32("linePosition");\r
- Fmessage = info.GetString("message");\r
-\r
- }\r
-\r
- /// <summary>\r
- /// Create a new XmlException\r
- /// </summary>\r
- /// <param name="message">Description of error</param>\r
- /// <param name="innerException">Exception causing error. Value can be null.</param>\r
- public XmlException(\r
- string message,\r
- Exception innerException\r
- )\r
- {\r
- Fmessage = message;\r
- }\r
- }\r
-}\r
+//
+// XmlException.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+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;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ msg = message;
+ }
+
+ protected XmlException (SerializationInfo info, StreamingContext context)
+ {
+ this.lineNumber = info.GetInt32 ("lineNumber");
+ this.linePosition = info.GetInt32 ("linePosition");
+ }
+
+ internal XmlException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ internal XmlException (string message, int lineNumber, int linePosition) : base (message)
+ {
+ this.lineNumber = lineNumber;
+ this.linePosition = linePosition;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ 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
+ }
+}