XDocument.Load Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Include Protected Members
Include Inherited Members

Include Silverlight Members
Include Silverlight for Windows Phone Members
Include XNA Framework Members

Creates a new XDocument from a file specified by a URI, from an TextReader, or from an XmlReader.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

Overload List

  Name Description
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(Stream) Creates a new XDocument instance using the specified stream.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(String) Creates a new XDocument from a file located in the application's XAP package.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(TextReader) Creates a new XDocument from a TextReader.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(XmlReader) Creates a new XDocument from an XmlReader.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(Stream, LoadOptions) Creates a new XDocument instance using the specified stream, optionally preserving white space, setting the base URI, and retaining line information.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(String, LoadOptions) Creates a new XDocument from a file located in the application's XAP package, optionally preserving white space, setting the base URI, and retaining line information.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(TextReader, LoadOptions) Creates a new XDocument from a TextReader, optionally preserving white space, setting the base URI, and retaining line information.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Load(XmlReader, LoadOptions) Creates a new XDocument from an XmlReader, optionally setting the base URI, and retaining line information.

Top

Remarks

Using one of the overloads of this method, you can load an XDocument from a file, a TextReader, or an XmlReader.

To create an XDocument from a string that contains XML, use Parse.