IXMLDOMDocument::load

banner art

Previous Next

IXMLDOMDocument::load

The load method loads an XML document with the contents of the file at the specified location.

Syntax

  HRESULT load(
 VARIANT varXmlSource, 
 VARIANT_BOOL* varIsSuccessful
);

Parameters

varXmlSource

[in] VARIANT containing a URL that specifies the location of the XML file. See Remarks.

bIsSuccessful

[out] Pointer to a VARIANT_BOOL indicating whether the load was successful.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Remarks

To indicate a specific data source plug-in other than the WMS File Data Source plug-in, the URL prefix for that plug-in must be specified. If no URL is specified, the server defaults to the WMS File Data Source plug-in. For example, to specify a file on a FAT, NTFS, or any CIFS file system, use c:\wmpub\wmroot\movie.xml or file://c:\wmpub\wmroot\movie.xml ("file://" identifies the URL scheme for the WMS File Data Source plug-in). The WMS HTML playlist parser plug-in supports only the .htm file extension.

Calling load or loadXML on an existing document immediately discards the content of the document.

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

Example Code

The following example retrieves a pointer to an IXMLDOMDocument interface and uses the load method to load a local XML file.

#include "wmsserver.h"
#include <atlbase.h> // Includes CComVariant and CComBSTR.

// Declare variables.
IWMSServer*         pServer;
IXMLDOMDocument*    pPlaylist;

HRESULT             hr;
VARIANT_BOOL        bIsSuccessful;
CComVariant         varFile;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer, NULL, CLSCTX_ALL, 
       IID_IWMSServer, (void**)&pServer);
if (FAILED(hr)) goto EXIT;

// Create the playlist object.
hr = pServer->CreatePlaylist(&pPlaylist);

// Load a sample playlist file.
varFile = "c:\\wmpub\\wmroot\\simple.wsx";
hr = pPlaylist->load(varFile, &bIsSuccessful);
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

Requirements

Header: wmsserver.h.

Library: WMSServerTypeLib.dll.

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

See Also

Previous Next