5 // Jason Diamond (jason@injektilo.org)
6 // Atsushi Enomoto (atsushi@ximian.com)
8 // (C) 2002 Jason Diamond http://injektilo.org/
9 // (C) 2004 Novell Inc.
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System
.Globalization
;
35 using System
.Runtime
.Serialization
;
40 public class XmlException
: SystemException
54 public XmlException ()
59 public XmlException (string message
, Exception innerException
)
60 : base (message
, innerException
)
64 protected XmlException (SerializationInfo info
, StreamingContext context
)
65 : base (info
, context
)
67 this.lineNumber
= info
.GetInt32 ("lineNumber");
68 this.linePosition
= info
.GetInt32 ("linePosition");
69 this.sourceUri
= info
.GetString ("sourceUri");
73 internal XmlException (string message
)
75 public XmlException (string message
)
81 internal XmlException (IXmlLineInfo li
, string sourceUri
, string message
) : base (message
)
84 this.lineNumber
= li
.LineNumber
;
85 this.linePosition
= li
.LinePosition
;
87 this.sourceUri
= sourceUri
;
91 internal XmlException (string message
, Exception innerException
, int lineNumber
, int linePosition
)
93 public XmlException (string message
, Exception innerException
, int lineNumber
, int linePosition
)
95 : base (message
, innerException
)
97 this.lineNumber
= lineNumber
;
98 this.linePosition
= linePosition
;
105 public int LineNumber
{
106 get { return lineNumber; }
109 public int LinePosition
{
110 get { return linePosition; }
114 public string SourceUri
{
115 get { return sourceUri; }
119 public override string Message
{
124 return String
.Format (CultureInfo
.InvariantCulture
, "{0} {3} Line {1}, position {2}.",
125 base.Message
, lineNumber
, linePosition
, sourceUri
);
133 public override void GetObjectData (SerializationInfo info
, StreamingContext context
)
135 base.GetObjectData (info
, context
);
136 info
.AddValue ("lineNumber", lineNumber
);
137 info
.AddValue ("linePosition", linePosition
);
138 info
.AddValue ("sourceUri", sourceUri
);