Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.gif)
| Previous | Next |
IXMLDOMNode::hasChildNodes
The hasChildNodes method retrieves a Boolean value indicating whether this node has children.
Syntax
HRESULT hasChildNodes( VARIANT_BOOL* varHasChild );
Parameters
varHasChild
[out] Pointer to a VARIANT_BOOL. Retrieves value that indicates whether this node has children.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Remarks
This method receives a value of true if this node has children, and false if it does not.
Example Code
The following example checks a node to determine whether it has any child nodes.
#include "wmsserver.h"
#include <atlbase.h> // Includes CComVariant and CComBSTR.
// Declare variables.
IWMSServer* pServer;
IXMLDOMDocument* pPlaylist;
IXMLDOMElement* pXMLElement;
IXMLDOMNode* pXMLNode;
HRESULT hr;
CComVariant varFile;
VARIANT_BOOL bIsSuccessful;
VARIANT_BOOL bHasChildren;
// 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;
if (bIsSuccessful)
{
// Retrieve a pointer to an IXMLDOMElement interface.
hr = pPlaylist->get_documentElement(&pXMLElement);
if (FAILED(hr)) goto EXIT;
// Retrieve the first child node from the document.
hr = pXMLElement->get_firstChild(&pXMLNode);
if (FAILED(hr)) goto EXIT;
// Retrieve a Boolean value indicating whether
// this node has child nodes attached to it.
hr = pXMLNode->hasChildNodes(&bHasChildren);
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 |