XmlException.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // XmlException.cs
  3. //
  4. // Author:
  5. // Jason Diamond ([email protected])
  6. //
  7. // (C) 2002 Jason Diamond http://injektilo.org/
  8. //
  9. using System;
  10. using System.Runtime.Serialization;
  11. namespace System.Xml
  12. {
  13. [Serializable]
  14. public class XmlException : SystemException
  15. {
  16. #region Fields
  17. int lineNumber;
  18. int linePosition;
  19. #endregion
  20. #region Constructors
  21. public XmlException (string message, Exception innerException)
  22. : base (message, innerException)
  23. {
  24. }
  25. protected XmlException (SerializationInfo info, StreamingContext context)
  26. {
  27. this.lineNumber = info.GetInt32 ("lineNumber");
  28. this.linePosition = info.GetInt32 ("linePosition");
  29. }
  30. internal XmlException (string message)
  31. : base (message)
  32. {
  33. }
  34. internal XmlException (string message, int lineNumber, int linePosition) : base (message)
  35. {
  36. this.lineNumber = lineNumber;
  37. this.linePosition = linePosition;
  38. }
  39. #endregion
  40. #region Properties
  41. public int LineNumber
  42. {
  43. get { return lineNumber; }
  44. }
  45. public int LinePosition
  46. {
  47. get { return linePosition; }
  48. }
  49. #endregion
  50. #region Methods
  51. public override void GetObjectData (SerializationInfo info, StreamingContext context)
  52. {
  53. base.GetObjectData (info, context);
  54. info.AddValue ("lineNumber", lineNumber);
  55. info.AddValue ("linePosition", linePosition);
  56. }
  57. #endregion
  58. }
  59. }