XmlSyntaxException 构造函数
定义
初始化 XmlSyntaxException 类的新实例。Initializes a new instance of the XmlSyntaxException class.
重载
| XmlSyntaxException() |
使用默认属性初始化 XmlSyntaxException 类的新实例。Initializes a new instance of the XmlSyntaxException class with default properties. |
| XmlSyntaxException(Int32) |
用检测到异常时的行号初始化 XmlSyntaxException 类的新实例。Initializes a new instance of the XmlSyntaxException class with the line number where the exception was detected. |
| XmlSyntaxException(String) |
用指定的错误消息初始化 XmlSyntaxException 类的新实例。Initializes a new instance of the XmlSyntaxException class with a specified error message. |
| XmlSyntaxException(Int32, String) |
用指定的错误信息和检测到异常时的行号初始化 XmlSyntaxException 类的新实例。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) |
使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 XmlSyntaxException 类的新实例。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()
使用默认属性初始化 XmlSyntaxException 类的新实例。Initializes a new instance of the XmlSyntaxException class with default properties.
public:
XmlSyntaxException();
public XmlSyntaxException ();
Public Sub New ()
注解
下表显示了 XmlSyntaxException 实例的初始属性值。The following table shows the initial property values for an instance of XmlSyntaxException.
| propertiesProperty | “值”Value |
|---|---|
| InnerException | null.null. |
| Message | "语法无效"。"Invalid syntax." |
适用于
XmlSyntaxException(Int32)
用检测到异常时的行号初始化 XmlSyntaxException 类的新实例。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)
参数
- lineNumber
- Int32
XML 流的行号,在此行中检测到 XML 语法错误。The line number of the XML stream where the XML syntax error was detected.
注解
只要检测到换行符,XML 流的行号就会更新。The line number of an XML stream is updated whenever a newline character is detected. 第一行从1开始编号。Numbering begins with 1 for the first line.
下表显示了 XmlSyntaxException 实例的初始属性值。The following table shows the initial property values for an instance of XmlSyntaxException.
| propertiesProperty | “值”Value |
|---|---|
| InnerException | null.null. |
| Message | "行中的语法无效 lineNumber "。"Invalid syntax on line lineNumber." |
适用于
XmlSyntaxException(String)
用指定的错误消息初始化 XmlSyntaxException 类的新实例。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)
参数
- message
- String
解释异常原因的错误消息。The error message that explains the reason for the exception.
注解
下表显示了 XmlSyntaxException 实例的初始属性值。The following table shows the initial property values for an instance of XmlSyntaxException.
| propertiesProperty | “值”Value |
|---|---|
| InnerException | null.null. |
| Message | 错误消息字符串。The error message string. |
适用于
XmlSyntaxException(Int32, String)
用指定的错误信息和检测到异常时的行号初始化 XmlSyntaxException 类的新实例。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)
参数
- lineNumber
- Int32
XML 流的行号,在此行中检测到 XML 语法错误。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.
注解
只要检测到换行符,XML 流的行号就会更新。The line number of an XML stream is updated whenever a newline character is detected. 第一行从1开始编号。Numbering begins with 1 for the first line.
下表显示了 XmlSyntaxException 实例的初始属性值。The following table shows the initial property values for an instance of XmlSyntaxException.
| propertiesProperty | “值”Value |
|---|---|
| InnerException | null.null. |
| Message | "行中的语法无效 lineNumber - message ""Invalid syntax on line lineNumber - message " |
适用于
XmlSyntaxException(String, Exception)
使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 XmlSyntaxException 类的新实例。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)
参数
- message
- String
解释异常原因的错误消息。The error message that explains the reason for the exception.
- inner
- Exception
导致当前异常的异常。The exception that is the cause of the current exception. 如果 inner 参数不为 null,则当前异常将在处理内部异常的 catch 块中引发。If the inner parameter is not null, the current exception is raised in a catch block that handles the inner exception.
注解
因前一个异常而直接引发的异常应在 InnerException 属性中包含对前一个异常的引用。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. InnerException 属性将返回传递给构造函数的同一值;如果 InnerException 属性不向构造函数提供内部异常值,则返回 null。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.
下表显示了 XmlSyntaxException 实例的初始属性值。The following table shows the initial property values for an instance of XmlSyntaxException.
| propertiesProperty | “值”Value |
|---|---|
| InnerException | 内部异常引用。The inner exception reference. |
| Message | 错误消息字符串。The error message string. |