When compiling CORLIB: pass the INSIDE_CORLIB setting, so X509Certificate class is...
[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 #if NET_1_0
28 #else
29                 public XmlException () 
30                         : base ()
31                 {
32                 }
33 #endif
34                 public XmlException (string message, Exception innerException) 
35                         : base (message, innerException)
36                 {
37                 }
38
39                 protected XmlException (SerializationInfo info, StreamingContext context)
40                         : base (info, context)
41                 {
42                         this.lineNumber = info.GetInt32 ("lineNumber");
43                         this.linePosition = info.GetInt32 ("linePosition");
44                 }
45
46 #if NET_1_0
47                 internal XmlException (string message)
48 #else
49                 public XmlException (string message)
50 #endif
51                         : base (message)
52                 {
53                 }
54
55                 internal XmlException (IXmlLineInfo li, string message) : base (message)
56                 {
57                         if (li != null) {
58                                 this.lineNumber = li.LineNumber;
59                                 this.linePosition = li.LinePosition;
60                         }
61                 }
62                 
63 #if NET_1_0
64                 internal XmlException (string message, int lineNumber, int linePosition)
65 #else
66                 public XmlException (string message, int lineNumber, int linePosition)
67 #endif
68                         : base (message)
69                 {
70                         this.lineNumber = lineNumber;
71                         this.linePosition = linePosition;
72                 }
73
74                 #endregion
75
76                 #region Properties
77
78                 public int LineNumber {
79                         get { return lineNumber; }
80                 }
81
82                 public int LinePosition {
83                         get { return linePosition; }
84                 }
85
86                 public override string Message {
87                         get {
88                                 if (lineNumber == 0)
89                                         return base.Message;
90
91                                 return String.Format ("{0} Line {1}, position {2}.",
92                                                       base.Message, lineNumber, linePosition);
93                         }
94                 }
95
96                 #endregion
97
98                 #region Methods
99
100                 public override void GetObjectData (SerializationInfo info, StreamingContext context)
101                 {
102                         base.GetObjectData (info, context);
103                         info.AddValue ("lineNumber", lineNumber);
104                         info.AddValue ("linePosition", linePosition);
105                 }
106
107                 #endregion
108         }
109 }