XmlException Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy XmlException.

Przeciążenia

XmlException()

Inicjuje nowe wystąpienie klasy XmlException.

XmlException(String)

Inicjuje XmlException nowe wystąpienie klasy z określonym komunikatem o błędzie.

XmlException(SerializationInfo, StreamingContext)
Przestarzałe.

Inicjuje XmlException nowe wystąpienie klasy przy użyciu informacji w SerializationInfo obiektach i StreamingContext .

XmlException(String, Exception)

Inicjuje nowe wystąpienie klasy XmlException.

XmlException(String, Exception, Int32, Int32)

Inicjuje XmlException nowe wystąpienie klasy z określonym komunikatem, wyjątkiem wewnętrznym, numerem wiersza i położeniem wiersza.

XmlException()

Inicjuje nowe wystąpienie klasy XmlException.

public:
 XmlException();
public XmlException ();
Public Sub New ()

Uwagi

Jest XmlException to ogólny błąd związany z xml, który jest zgłaszany w przypadku wystąpienia problemów podczas przetwarzania XML. Poniższy przykład zgłasza wyjątek XML, ponieważ <tag końcowy kontaktów> jest błędnie napisany:

using System;
using System.Xml.Linq;

try
{
    XElement contacts = XElement.Parse(
        @"<Contacts>
            <Contact>
                <Name>Jim Wilson</Name>
            </Contact>
          </Contcts>");
    Console.WriteLine(contacts);
}
catch (System.Xml.XmlException e)
{
    Console.WriteLine(e.Message);
}
Try
    Dim contacts As XElement = XElement.Parse(
        "<Contacts>  
            <Contact>  
                <Name>Jim Wilson</Name>  
            </Contact>  
         </Contcts>")
    Console.WriteLine(contacts)
Catch e As System.Xml.XmlException
    Console.WriteLine(e.Message)
End Try

Dotyczy

XmlException(String)

Inicjuje XmlException nowe wystąpienie klasy z określonym komunikatem o błędzie.

public:
 XmlException(System::String ^ message);
public XmlException (string message);
public XmlException (string? message);
new System.Xml.XmlException : string -> System.Xml.XmlException
Public Sub New (message As String)

Parametry

message
String

Opis błędu.

Dotyczy

XmlException(SerializationInfo, StreamingContext)

Przestroga

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

Inicjuje XmlException nowe wystąpienie klasy przy użyciu informacji w SerializationInfo obiektach i StreamingContext .

protected:
 XmlException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected XmlException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected XmlException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Xml.XmlException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Xml.XmlException
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Xml.XmlException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Xml.XmlException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parametry

info
SerializationInfo

Obiekt SerializationInfo zawierający wszystkie właściwości obiektu XmlException.

context
StreamingContext

StreamingContext Obiekt zawierający informacje kontekstowe.

Atrybuty

Dotyczy

XmlException(String, Exception)

Inicjuje nowe wystąpienie klasy XmlException.

public:
 XmlException(System::String ^ message, Exception ^ innerException);
public XmlException (string message, Exception innerException);
public XmlException (string? message, Exception? innerException);
new System.Xml.XmlException : string * Exception -> System.Xml.XmlException
Public Sub New (message As String, innerException As Exception)

Parametry

message
String

Opis warunku błędu.

innerException
Exception

To Exception rzuciło XmlException, jeśli istnieje. Ta wartość może mieć wartość null.

Dotyczy

XmlException(String, Exception, Int32, Int32)

Inicjuje XmlException nowe wystąpienie klasy z określonym komunikatem, wyjątkiem wewnętrznym, numerem wiersza i położeniem wiersza.

public:
 XmlException(System::String ^ message, Exception ^ innerException, int lineNumber, int linePosition);
public XmlException (string message, Exception innerException, int lineNumber, int linePosition);
public XmlException (string? message, Exception? innerException, int lineNumber, int linePosition);
new System.Xml.XmlException : string * Exception * int * int -> System.Xml.XmlException
Public Sub New (message As String, innerException As Exception, lineNumber As Integer, linePosition As Integer)

Parametry

message
String

Opis błędu.

innerException
Exception

Wyjątek będący przyczyną bieżącego wyjątku. Ta wartość może mieć wartość null.

lineNumber
Int32

Numer wiersza wskazujący, gdzie wystąpił błąd.

linePosition
Int32

Pozycja wiersza wskazująca, gdzie wystąpił błąd.

Dotyczy