IXMLDOMDocument.loadXML (C#)

banner art

Previous Next

IXMLDOMDocument.loadXML (C#)

The loadXML method loads the supplied string into an XML document.

Syntax

  Boolean = IXMLDOMDocument
  .loadXML(
  string strXML
);

Parameters

strXML

[in] string containing the XML string to load into this XML document object. This string can contain an entire XML document or a well-formed fragment.

Return Values

Returns true if the XML load succeeded. If the load failed, the method returns false and sets the documentElement property of the IXMLDOMDocument object to NULL.

Remarks

Calling load or loadXML on an existing document immediately discards the content of the document. The loadXML method will work only with UTF-8 encodings.

This method is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).

Example Code

The following example creates an IXMLDOMDocument object, and then uses its loadXML method to load the specified XML.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Create a new playlist object.
    Playlist = Server.CreatePlaylist();

    // Load the specified XML.
    Playlist.loadXML
    ("<?wsx version \"1.0\" ?><smil><media src =
                             \"welcome1.asf\"/></smil>");
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add references to Microsoft.WindowsMediaServices and interop_msxml.

Namespace: Microsoft.WindowsMediaServices.Interop, interop_msxml.

Assembly: Microsoft.WindowsMediaServices.dll, interop_msxml.dll.

Library: WMSServerTypeLib.dll, msxml.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next