XmlSyntaxException Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the XmlSyntaxException class.
Overloads
XmlSyntaxException() |
Initializes a new instance of the XmlSyntaxException class with default properties. |
XmlSyntaxException(Int32) |
Initializes a new instance of the XmlSyntaxException class with the line number where the exception was detected. |
XmlSyntaxException(String) |
Initializes a new instance of the XmlSyntaxException class with a specified error message. |
XmlSyntaxException(Int32, String) |
Initializes a new instance of the XmlSyntaxException class with a specified error message and the line number where the exception was detected. |
XmlSyntaxException(String, Exception) |
Initializes a new instance of the XmlSyntaxException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
XmlSyntaxException()
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
Initializes a new instance of the XmlSyntaxException class with default properties.
public:
XmlSyntaxException();
public XmlSyntaxException ();
Public Sub New ()
Remarks
The following table shows the initial property values for an instance of XmlSyntaxException.
Property | Value |
---|---|
InnerException | null . |
Message | "Invalid syntax." |
Applies to
XmlSyntaxException(Int32)
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
Initializes a new instance of the XmlSyntaxException class with the line number where the exception was detected.
public:
XmlSyntaxException(int lineNumber);
public XmlSyntaxException (int lineNumber);
new System.Security.XmlSyntaxException : int -> System.Security.XmlSyntaxException
Public Sub New (lineNumber As Integer)
Parameters
- lineNumber
- Int32
The line number of the XML stream where the XML syntax error was detected.
Remarks
The line number of an XML stream is updated whenever a newline character is detected. Numbering begins with 1 for the first line.
The following table shows the initial property values for an instance of XmlSyntaxException.
Property | Value |
---|---|
InnerException | null . |
Message | "Invalid syntax on line lineNumber ." |
Applies to
XmlSyntaxException(String)
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
Initializes a new instance of the XmlSyntaxException class with a specified error message.
public:
XmlSyntaxException(System::String ^ message);
public XmlSyntaxException (string message);
new System.Security.XmlSyntaxException : string -> System.Security.XmlSyntaxException
Public Sub New (message As String)
Parameters
- message
- String
The error message that explains the reason for the exception.
Remarks
The following table shows the initial property values for an instance of XmlSyntaxException.
Property | Value |
---|---|
InnerException | null . |
Message | The error message string. |
Applies to
XmlSyntaxException(Int32, String)
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
Initializes a new instance of the XmlSyntaxException class with a specified error message and the line number where the exception was detected.
public:
XmlSyntaxException(int lineNumber, System::String ^ message);
public XmlSyntaxException (int lineNumber, string message);
new System.Security.XmlSyntaxException : int * string -> System.Security.XmlSyntaxException
Public Sub New (lineNumber As Integer, message As String)
Parameters
- lineNumber
- Int32
The line number of the XML stream where the XML syntax error was detected.
- message
- String
The error message that explains the reason for the exception.
Remarks
The line number of an XML stream is updated whenever a newline character is detected. Numbering begins with 1 for the first line.
The following table shows the initial property values for an instance of XmlSyntaxException.
Property | Value |
---|---|
InnerException | null . |
Message | "Invalid syntax on line lineNumber - message " |
Applies to
XmlSyntaxException(String, Exception)
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
- Source:
- XmlSyntaxException.cs
Initializes a new instance of the XmlSyntaxException class with a specified error message and a reference to the inner exception that is the cause of this exception.
public:
XmlSyntaxException(System::String ^ message, Exception ^ inner);
public XmlSyntaxException (string message, Exception inner);
new System.Security.XmlSyntaxException : string * Exception -> System.Security.XmlSyntaxException
Public Sub New (message As String, inner As Exception)
Parameters
- message
- String
The error message that explains the reason for the exception.
- inner
- Exception
The exception that is the cause of the current exception. If the inner
parameter is not null
, the current exception is raised in a catch
block that handles the inner exception.
Remarks
An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. The InnerException property returns the same value that is passed into the constructor, or null
if the InnerException property does not supply the inner exception value to the constructor.
The following table shows the initial property values for an instance of XmlSyntaxException.
Property | Value |
---|---|
InnerException | The inner exception reference. |
Message | The error message string. |