Load()

XmlDocument::Load(String) method

Loads the XML document from the specified URL.

virtual void System::Xml::XmlDocument::Load(String filename)

Arguments

ParameterTypeDescription
filenameStringURL for the file containing the XML document to load. The URL can be either a local file or an HTTP URL (a Web address).

Exceptions

ExceptionDescription
XmlExceptionThere is a load or parse error in the XML. In this case, a FileNotFoundException is raised.
ArgumentExceptionfilename is a zero-length string, contains only white space, or contains one or more invalid characters as defined by System::IO::Path::GetInvalidPathChars.
ArgumentNullExceptionfilename is nullptr.
PathTooLongExceptionThe specified path, file name, or both exceed the system-defined maximum length.
DirectoryNotFoundExceptionThe specified path is invalid (for example, it is on an unmapped drive).
IOExceptionAn I/O error occurred while opening the file.
UnauthorizedAccessExceptionfilename specified a file that is read-only. This operation is not supported on the current platform. filename specified a directory. The caller does not have the required permission.
FileNotFoundExceptionThe file specified in filename was not found.
NotSupportedExceptionfilename is in an invalid format.
SecurityExceptionThe caller does not have the required permission.

XmlDocument::Load(SharedPtr<IO::Stream>) method

Loads the XML document from the specified stream.

virtual void System::Xml::XmlDocument::Load(SharedPtr<IO::Stream> inStream)

Arguments

ParameterTypeDescription
inStreamSharedPtr<IO::Stream>The stream containing the XML document to load.

Exceptions

ExceptionDescription
XmlExceptionThere is a load or parse error in the XML. In this case, a FileNotFoundException is raised.

XmlDocument::Load(SharedPtr<IO::TextReader>) method

Loads the XML document from the specified TextReader.

virtual void System::Xml::XmlDocument::Load(SharedPtr<IO::TextReader> txtReader)

Arguments

ParameterTypeDescription
txtReaderSharedPtr<IO::TextReader>The TextReader used to feed the XML data into the document.

Exceptions

ExceptionDescription
XmlExceptionThere is a load or parse error in the XML. In this case, the document remains empty.

XmlDocument::Load(SharedPtr<XmlReader>) method

Loads the XML document from the specified XmlReader.

virtual void System::Xml::XmlDocument::Load(SharedPtr<XmlReader> reader)

Arguments

ParameterTypeDescription
readerSharedPtr<XmlReader>The XmlReader used to feed the XML data into the document.

Exceptions

ExceptionDescription
XmlExceptionThere is a load or parse error in the XML. In this case, the document remains empty.

See Also