This documentation is archived and is not being maintained.

XmlDocument.Load Method (Stream)

.NET Framework 1.1

Loads the XML document from the specified stream.

[Visual Basic]
Overloads Public Overridable Sub Load( _
   ByVal inStream As Stream _
public virtual void Load(
 Stream inStream
public: virtual void Load(
 Stream* inStream
public function Load(
   inStream : Stream


The stream containing the XML document to load.


Exception Type Condition
XmlException There is a load or parse error in the XML. In this case, the document remains empty.


Note   The Load method always preserves significant white space. The PreserveWhitespace property determines whether or not white space is preserved. The default is false, white space is not preserved.

This method does not do DTD or schema validation. If you want validation to occur, you need to pass an XmlValidatingReader, specify the appropriate XmlValidatingReader.ValidationType, and provide a XmlValidatingReader.ValidationEventHandler. You are then notified of all validation errors found during Load, and unless your ValidationEventHandler throws an exception to stop the process, the document will still be loaded. See XmlDocument for an example of load-time validation

This method is a Microsoft extension to the Document Object Model (DOM).


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

XmlDocument Class | XmlDocument Members | System.Xml Namespace | XmlDocument.Load Overload List | System.Xml.Schema.ValidationEventArgs | System.Xml.Schema.XmlSeverityType | XmlValidatingReader.Schemas