XmlException Konstruktory

Definice

Inicializuje novou instanci XmlException třídy .

Přetížení

XmlException()

Inicializuje novou instanci XmlException třídy .

XmlException(String)

Inicializuje novou instanci XmlException třídy se zadanou chybovou zprávou.

XmlException(SerializationInfo, StreamingContext)
Zastaralé.

Inicializuje novou instanci XmlException třídy pomocí informací v objektech SerializationInfo a StreamingContext .

XmlException(String, Exception)

Inicializuje novou instanci XmlException třídy .

XmlException(String, Exception, Int32, Int32)

Inicializuje novou instanci XmlException třídy se zadanou zprávou, vnitřní výjimkou, číslem řádku a umístěním řádku.

XmlException()

Source:
XmlException.cs
Source:
XmlException.cs
Source:
XmlException.cs

Inicializuje novou instanci XmlException třídy .

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

Poznámky

Je XmlException obecná chyba související s XML, která je vyvolán, pokud dojde k problémům během zpracování XML. Následující příklad vyvolá výjimku XML, protože <koncová značka kontaktů> je chybně napsaná:

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

Platí pro

XmlException(String)

Source:
XmlException.cs
Source:
XmlException.cs
Source:
XmlException.cs

Inicializuje novou instanci XmlException třídy se zadanou chybovou zprávou.

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

Popis chyby.

Platí pro

XmlException(SerializationInfo, StreamingContext)

Source:
XmlException.cs
Source:
XmlException.cs
Source:
XmlException.cs

Upozornění

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

Inicializuje novou instanci XmlException třídy pomocí informací v objektech SerializationInfo a 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

Objekt SerializationInfo obsahující všechny vlastnosti objektu XmlException.

context
StreamingContext

Objekt StreamingContext obsahující kontextové informace.

Atributy

Platí pro

XmlException(String, Exception)

Source:
XmlException.cs
Source:
XmlException.cs
Source:
XmlException.cs

Inicializuje novou instanci XmlException třídy .

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

Popis chybového stavu.

innerException
Exception

Ten Exception , který vyhodil XmlException, pokud vůbec nějaký. Tato hodnota může být null.

Platí pro

XmlException(String, Exception, Int32, Int32)

Source:
XmlException.cs
Source:
XmlException.cs
Source:
XmlException.cs

Inicializuje novou instanci XmlException třídy se zadanou zprávou, vnitřní výjimkou, číslem řádku a umístěním řádku.

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

Popis chyby.

innerException
Exception

Výjimka, která je příčinou aktuální výjimky Tato hodnota může být null.

lineNumber
Int32

Číslo řádku označující, kde k chybě došlo.

linePosition
Int32

Pozice řádku označující, kde došlo k chybě.

Platí pro