IXMLDOMDocument.createNode (Visual Basic .NET)
Previous | Next |
IXMLDOMDocument.createNode (Visual Basic .NET)
The createNode method creates a node using the supplied type, name, and namespace.
Syntax
IXMLDOMNode = IXMLDOMDocument .createNode( varType As Variant, strName As String, strNamespaceURI As String )
Parameters
varType
[in] Variant with a value that uniquely identifies the node type. This can be specified using either the integer value or the string value.
strName
[in] String containing the value for the new node's nodeName property. The relationship between the node name and node type is summarized below.
strNamespaceURI
[in] String defining the namespace Uniform Resource Identifier (URI). It does not matter what value is assigned to this String because the Windows Media Services SDK implementation of the XML DOM does not fully support namespaces.
Return Values
Returns the newly created node.
Remarks
The strName parameter depends on the value of the varType parameter as shown in the following table. For example, if the node type of the varType parameter is NODE_ELEMENT, the strName parameter will be the node name of the element node.
varType parameter | strName parameter |
NODE_COMMENT NODE_TEXT |
The nodeName property for this node type is a constant value; the strName parameter is ignored. |
NODE_ELEMENT | The name of the XML element tag, with any namespace prefix included if present. |
NODE_PROCESSING_INSTRUCTION | The target (the first token following the <? characters). |
You cannot create a node of type NODE_ATTRIBUTE, NODE_DOCUMENT, NODE_DOCUMENT_TYPE, NODE_ENTITY, or NODE_NOTATION.
This member is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).
Example Code
The following example creates an element node called "media" and adds it to the child elements for the IXMLDOMDocument object.
Imports interop_msxml Imports Microsoft.WindowsMediaServices.Interop On Error GoTo Err ' Declare variables. Dim Server As New WMSServerClass() Dim Playlist As IXMLDOMDocument Dim root As IXMLDOMElement Dim newNode As IXMLDOMNode ' Create a new playlist object. Set Playlist = Server.CreatePlaylist ' Load a playlist. Playlist.Load ("file://c:\wmpub\wmroot\simple.wsx") ' Retrieve the root element. Set root = Playlist.documentElement ' Create a new node and append it as a child node of ' the root element. Set newNode = Playlist.createNode(NODE_ELEMENT, "media", "") root.appendChild newNode Exit Sub Err: ' TODO: Handle errors.
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
- IXMLDOMDocument Object (Visual Basic .NET)
- IXMLDOMNode Object (Visual Basic .NET)
- XML DOM Methods (Visual Basic .NET)
Previous | Next |