2002-03-13 Duncan Mak <duncan@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml / XmlException.cs
1 //
2 // XmlException.cs
3 //
4 // Author:
5 //   Jason Diamond (jason@injektilo.org)
6 //
7 // (C) 2002 Jason Diamond  http://injektilo.org/
8 //
9
10 using System;
11 using System.Runtime.Serialization;
12
13 namespace System.Xml
14 {
15         [Serializable]
16         public class XmlException : SystemException
17         {
18                 #region Fields
19
20                 int lineNumber;
21                 int linePosition;
22
23                 #endregion
24
25                 #region Constructors
26
27                 public XmlException (string message, Exception innerException) 
28                         : base (message, innerException)
29                 {
30                 }
31
32                 protected XmlException (SerializationInfo info, StreamingContext context)
33                 {
34                         this.lineNumber = info.GetInt32 ("lineNumber");
35                         this.linePosition = info.GetInt32 ("linePosition");
36                 }
37
38                 internal XmlException (string message)
39                         : base (message)
40                 {
41                 }
42
43                 internal XmlException (string message, int lineNumber, int linePosition) : base (message)
44                 {
45                         this.lineNumber = lineNumber;
46                         this.linePosition = linePosition;
47                 }
48
49                 #endregion
50
51                 #region Properties
52
53                 public int LineNumber 
54                 {
55                         get { return lineNumber; }
56                 }
57
58                 public int LinePosition 
59                 {
60                         get { return linePosition; }
61                 }
62
63                 #endregion
64
65                 #region Methods
66
67                 public override void GetObjectData (SerializationInfo info, StreamingContext context)
68                 {
69                         base.GetObjectData (info, context);
70                         info.AddValue ("lineNumber", lineNumber);
71                         info.AddValue ("linePosition", linePosition);
72                 }
73
74                 #endregion
75         }
76 }