IXMLDOMNode.nodeType (C#)
Previous | Next |
IXMLDOMNode.nodeType (C#)
The nodeType property specifies the XML Document Object Model (DOM) node type, which determines valid values and whether the node can have child nodes.
Syntax
int = IXMLDOMNode.nodeType;
Remarks
The property is read-only. It indicates the type of the node. Use the nodeTypeString property to return the node type in string form. The following table describes the possible values for the nodeType property.
Node type | Description |
NODE_ELEMENT (1) | The node represents an element. An element node can have the following child node types: Element, and ProcessingInstruction. An element node can be the child of the document and element nodes. |
NODE_ATTRIBUTE (2) | The node represents an attribute of an element. An attribute does not appear as the child node of any other node type; it is not considered a child node of an element. |
NODE_TEXT (3) | The node represents the text content of a tag. A text node cannot have any child nodes. A text node can appear as the child node of the Attribute and Element nodes. |
NODE_PROCESSING_INSTRUCTION (7) | The node represents a processing instruction from the XML document. A processing instruction node cannot have any child nodes. A processing instruction node can appear as the child of the document and element nodes. |
NODE_COMMENT (8) | The node represents a comment in the XML document. A comment node cannot have any child nodes. A comment node can appear as the child of document and element nodes. |
NODE_DOCUMENT (9) | The node represents a document object that, as the root of the document tree, provides access to the entire XML document. A document node can have the following child node types: Element (maximum of one), and ProcessingInstruction. A document node cannot appear as the child of any node types. |
Example Code
The following example creates an IXMLDOMNode object and displays its type enumeration, in this case, 1 for NODE_ELEMENT.
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 and // display its node type. currNode = Playlist.documentElement.childNodes[0]; MessageBox.Show(currNode.nodeType.ToString()); } 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 |