XmlException.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  2. //
  3. // System.Xml.XmlException
  4. //
  5. // Author:
  6. // Daniel Weber ([email protected])
  7. //
  8. // (C) 2001 Daniel Weber
  9. using System;
  10. using System.Runtime.Serialization;
  11. namespace System.Xml
  12. {
  13. /// <summary>
  14. /// Abstract class XmlNodeList.
  15. /// </summary>
  16. public class XmlException : SystemException
  17. {
  18. // Private data members
  19. int FlineNumber;
  20. int FlinePosition;
  21. string Fmessage;
  22. // public properties
  23. /// <summary>
  24. /// Get the line number where the exception occured
  25. /// </summary>
  26. public int LineNumber
  27. {
  28. get
  29. {
  30. return FlineNumber;
  31. }
  32. }
  33. /// <summary>
  34. /// Get the line position where the exception occured.
  35. /// </summary>
  36. public int LinePosition
  37. {
  38. get
  39. {
  40. return FlinePosition;
  41. }
  42. }
  43. /// <summary>
  44. /// Get the error message describing the exception.
  45. /// </summary>
  46. public override string Message
  47. {
  48. get
  49. {
  50. return Fmessage;
  51. }
  52. }
  53. // Public Methods
  54. // Constructors
  55. /// <summary>
  56. /// Create a new XmlException object.
  57. /// </summary>
  58. /// <param name="info">The serializatin object holding all exception information.</param>
  59. /// <param name="context">The streaming context containing the context of the error</param>
  60. public XmlException(
  61. SerializationInfo info,
  62. StreamingContext context
  63. )
  64. {
  65. FlineNumber = info.GetInt32("lineNumber");
  66. FlinePosition = info.GetInt32("linePosition");
  67. Fmessage = info.GetString("message");
  68. }
  69. /// <summary>
  70. /// Create a new XmlException
  71. /// </summary>
  72. /// <param name="message">Description of error</param>
  73. /// <param name="innerException">Exception causing error. Value can be null.</param>
  74. public XmlException(
  75. string message,
  76. Exception innerException
  77. )
  78. {
  79. Fmessage = message;
  80. }
  81. internal XmlException( string message, XmlInputSource src)
  82. {
  83. FlineNumber = src.lineNumber;
  84. FlinePosition = src.columnNumber;
  85. Fmessage = message;
  86. }
  87. }
  88. }