Implementation and tests for XmlAttributeCollection.RemoveAll and XmlElement.RemoveAl...
[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                 string msg;     //  Cache message here because SystemException doesn't expose it
21                 int lineNumber;
22                 int linePosition;
23
24                 #endregion
25
26                 #region Constructors
27
28                 public XmlException (string message, Exception innerException) 
29                         : base (message, innerException)
30                 {
31                         msg = message;
32                 }
33
34                 protected XmlException (SerializationInfo info, StreamingContext context)
35                         : base (info, context)
36                 {
37                         this.lineNumber = info.GetInt32 ("lineNumber");
38                         this.linePosition = info.GetInt32 ("linePosition");
39                 }
40
41                 internal XmlException (string message)
42                         : base (message)
43                 {
44                         msg = message;
45                 }
46
47                 internal XmlException (string message, int lineNumber, int linePosition) : base (message)
48                 {
49                         this.lineNumber = lineNumber;
50                         this.linePosition = linePosition;
51                 }
52
53                 #endregion
54
55                 #region Properties
56
57                 public int LineNumber {
58                         get { return lineNumber; }
59                 }
60
61                 public int LinePosition {
62                         get { return linePosition; }
63                 }
64
65                 public override string Message {
66                         get { return msg; }
67                 }
68
69                 #endregion
70
71                 #region Methods
72
73                 public override void GetObjectData (SerializationInfo info, StreamingContext context)
74                 {
75                         base.GetObjectData (info, context);
76                         info.AddValue ("lineNumber", lineNumber);
77                         info.AddValue ("linePosition", linePosition);
78                 }
79
80                 #endregion
81         }
82 }