IXMLDOMNode.appendChild (Visual Basic .NET)
Previous | Next |
IXMLDOMNode.appendChild (Visual Basic .NET)
The appendChild method appends the supplied new child as the last child of this node.
Syntax
IXMLDOMNode = IXMLDOMNode.appendChild( objnewChild As Object )
Parameters
newChild
[in] Object containing the new child node to be appended at the end of the list of children belonging to this node.
Return Values
Returns the new child node appended to the list.
Remarks
If newChild has an existing parent, the node is automatically removed from that parent before being inserted into its new location.
When inserting a node tree under another node that has a different owner document, the ownerDocument property for each inserted node is changed to match the owner document of its new parent.
When moving a node tree to another document, the content of all entity reference nodes contained therein is updated to conform to the new document. If the new document does not declare an entity that was moved into it, the entity reference will have no children, and the old content is removed. Existing references to nodes under the entity reference are still valid, but the node whose parent previously was the entity reference now has a null parent.
This is equivalent to calling insertBefore (newChild, NULL). For more information, see IXMLDOMNode.insertBefore.
Example Code
The following example creates a new IXMLDOMNode object, and then uses the appendChild method to append it to the document's list of children.
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
Previous | Next |