IXMLDOMNode.hasChildNodes (C#)
Previous | Next |
IXMLDOMNode.hasChildNodes (C#)
The hasChildNodes method returns a Boolean value indicating whether this node has children.
Syntax
bValue = IXMLDOMNode .hasChildNodes();
Parameters
This method takes no parameters.
Return Values
Returns true if this node has children, and false if it does not.
Remarks
This method always returns false for nodes that, by definition, cannot have children.
Example Code
The following example checks a node to determine whether it has any child nodes. If it does, the number of child nodes is displayed.
using Microsoft.WindowsMediaServices.Interop; using interop_msxml; // Declare variables. WMSServer Server; IXMLDOMDocument Playlist; IXMLDOMNode currNode; try { // Create a new WMSServer object. Server = new WMSServerClass(); // Create a new playlist object. Playlist = Server.CreatePlaylist(); // Load a playlist. Playlist.load("file://c:\\wmpub\\wmroot\\simple.wsx"); // Retrieve the first child node of the root element. currNode = Playlist.documentElement.firstChild; // Check whether the node has child nodes. if (currNode.hasChildNodes() == true) MessageBox.Show(currNode.childNodes.length.ToString()); else MessageBox.Show("no child nodes"); } 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 |