XDocument.LoadAsync Method

Definition

Overloads

LoadAsync(TextReader, LoadOptions, CancellationToken)

Creates a new XDocument and initializes its underlying XML tree using the specified TextReader parameter, optionally preserving white space.

LoadAsync(XmlReader, LoadOptions, CancellationToken)

Creates a new XDocument containing the contents of the specified XmlReader.

LoadAsync(Stream, LoadOptions, CancellationToken)

Asynchronously creates a new XDocument and initializes its underlying XML tree from the specified stream, optionally preserving white space.

LoadAsync(TextReader, LoadOptions, CancellationToken)

Creates a new XDocument and initializes its underlying XML tree using the specified TextReader parameter, optionally preserving white space.

public:
 static System::Threading::Tasks::Task<System::Xml::Linq::XDocument ^> ^ LoadAsync(System::IO::TextReader ^ textReader, System::Xml::Linq::LoadOptions options, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Xml.Linq.XDocument> LoadAsync (System.IO.TextReader textReader, System.Xml.Linq.LoadOptions options, System.Threading.CancellationToken cancellationToken);
static member LoadAsync : System.IO.TextReader * System.Xml.Linq.LoadOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Xml.Linq.XDocument>

Parameters

textReader
TextReader

A reader that contains the raw XML to read into the newly created XDocument.

options
LoadOptions

A set of load options.

cancellationToken
CancellationToken

A cancellation token.

Returns

A new XDocument containing the contents of the specified TextReader.

Remarks

If LoadOptions.PreserveWhitespace is set, the XmlReaderSettings.IgnoreWhitespace property is set to false.

LoadAsync(XmlReader, LoadOptions, CancellationToken)

Creates a new XDocument containing the contents of the specified XmlReader.

public:
 static System::Threading::Tasks::Task<System::Xml::Linq::XDocument ^> ^ LoadAsync(System::Xml::XmlReader ^ reader, System::Xml::Linq::LoadOptions options, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Xml.Linq.XDocument> LoadAsync (System.Xml.XmlReader reader, System.Xml.Linq.LoadOptions options, System.Threading.CancellationToken cancellationToken);
static member LoadAsync : System.Xml.XmlReader * System.Xml.Linq.LoadOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Xml.Linq.XDocument>

Parameters

reader
XmlReader

A reader containing the XML to be read into the new XDocument.

options
LoadOptions

A set of load options.

cancellationToken
CancellationToken

A cancellation token.

Returns

A new XDocument containing the contents of the specified XmlReader.

LoadAsync(Stream, LoadOptions, CancellationToken)

Asynchronously creates a new XDocument and initializes its underlying XML tree from the specified stream, optionally preserving white space.

public:
 static System::Threading::Tasks::Task<System::Xml::Linq::XDocument ^> ^ LoadAsync(System::IO::Stream ^ stream, System::Xml::Linq::LoadOptions options, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Xml.Linq.XDocument> LoadAsync (System.IO.Stream stream, System.Xml.Linq.LoadOptions options, System.Threading.CancellationToken cancellationToken);
static member LoadAsync : System.IO.Stream * System.Xml.Linq.LoadOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Xml.Linq.XDocument>

Parameters

stream
Stream

A stream containing the raw XML to read into the newly created XDocument.

options
LoadOptions

A set of load options.

cancellationToken
CancellationToken

A cancellation token.

Returns

A new XDocument containing the contents of the specified Stream.

Remarks

If LoadOptions.PreserveWhitespace is set, the underlying XmlReaderSettings.IgnoreWhitespace property is set to false.

Applies to