public class XmlException : SystemException
Object
Exception
SystemException
XmlException
System.Xml
XML
Represents the error that occurs when an XML document or fragment cannot be parsed.
System.Xml Namespace
XmlException Constructors
XmlException() Constructor
XmlException(System.String) Constructor
XmlException(System.String, System.Exception, int, int) Constructor
XmlException(System.String, System.Exception) Constructor
XmlException Properties
XmlException.LineNumber Property
XmlException.LinePosition Property
XmlException.Message Property
public XmlException();
Constructs and initializes a new instance of the XmlException class.
This constructor initializes the System.Xml.XmlException.Message property of the new instance to a system-supplied message that describes the error, such as "An XML error has occurred." This message takes into account the current system culture.The System.Xml.XmlException.InnerException property is initialized to
null
. The System.Xml.XmlException.LineNumber and System.Xml.XmlException.LinePosition properties are initialized to zero.
System.Xml.XmlException Class, System.Xml Namespace
public XmlException(string message);
Constructs and initializes a new instance of the XmlException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
This constructor initializes the System.Xml.XmlException.Message property of the new instance using message. If the message parameter isnull
, the System.Xml.XmlException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.The System.Xml.XmlException.InnerException property is initialized to
null
. The System.Xml.XmlException.LineNumber and System.Xml.XmlException.LinePosition properties are initialized to zero.
System.Xml.XmlException Class, System.Xml Namespace
public XmlException(string message, Exception innerException, int lineNumber, int linePosition);
Constructs and initializes a new instance of the XmlException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- innerException
- An instance of Exception that is the cause of the current Exception. If innerException is non-null, then the current Exception was raised in a catch block handling innerException .
- lineNumber
- A Int32 that specifies the line number where the error occurred.
- linePosition
- A Int32 that specifies the character position where the error occurred.
This constructor initializes the System.Xml.XmlException.Message property of the new instance using message, the System.Xml.XmlException.InnerException property using innerException, the System.Xml.XmlException.LineNumber property using lineNumber, and the System.Xml.XmlException.LinePosition property using linePosition. If the message parameter isnull
, the System.Xml.XmlException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.[Note: For information on inner exceptions, see System.Exception.InnerException.]
System.Xml.XmlException Class, System.Xml Namespace
public XmlException(string message, Exception innerException);
Constructs and initializes a new instance of the XmlException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- innerException
- An instance of Exception that is the cause of the current exception. If innerException is not a
null
reference, the current exception was raised in a catch block handling innerException.
This constructor initializes the System.Xml.XmlException.Message property of the new instance using message and the System.Xml.XmlException.InnerException property using innerException. If the message parameter isnull
, the System.Xml.XmlException.Message property is set to the system-supplied message provided by the constructor that takes no arguments.The System.Xml.XmlException.LineNumber and System.Xml.XmlException.LinePosition properties are initialized to zero.
[Note: For more information on inner exceptions, see System.Exception.InnerException.]
System.Xml.XmlException Class, System.Xml Namespace
public int LineNumber { get; }
Gets the line number where the error occurred.
A Int32 containing the line number where the error occurred.
This property is read-only.
System.Xml.XmlException Class, System.Xml Namespace
public int LinePosition { get; }
Gets the character position where the error occurred.
A Int32 containing the character position where the error occurred.
This property is read-only.The first character in the line is in position 1. Note that white space characters at the start of the line are not skipped.
System.Xml.XmlException Class, System.Xml Namespace
public override string Message { get; }
Gets the error message that describes the current exception.
A String containing the error message that describes the current exception.
This property is read-only.If the System.Xml.XmlException.LineNumber property is not equal to zero, the string returned by this property includes the values of the System.Xml.XmlException.LineNumber and System.Xml.XmlException.LinePosition properties.
[Note: This property overrides System.Exception.Message.]
System.Xml.XmlException Class, System.Xml Namespace