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 |
IXMLDOMDocument.createAttribute (Visual Basic .NET)
The createAttribute method creates a new attribute with the specified name.
Syntax
IXMLDOMAttribute = IXMLDOMDocument .createAttribute( strName As String )
Parameters
strName
[in] String specifying the name of the new attribute object. This name is subsequently available as the new node's nodeName property.
Return Values
Returns the new IXMLDOMAttribute object.
Remarks
No data value is set for the attribute during the create operation. You can set the value by calling the setAttribute method of the element object.
The parentNode property is always set to NULL.
The nodeType property has the value NODE_ATTRIBUTE.
Example Code
The following example creates a new attribute called ID and adds it to the attributes of 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 newAtt As IXMLDOMAttribute
Dim namedNodeMap As IXMLDOMNamedNodeMap
' 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 attribute and add it
' to the attributes of the root element.
Set newAtt = Playlist.createAttribute("ID")
Set namedNodeMap = root.Attributes
namedNodeMap.setNamedItem newAtt
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
- IXMLDOMAttribute Object (Visual Basic .NET)
- IXMLDOMDocument Object (Visual Basic .NET)
- XML DOM Methods (Visual Basic .NET)
| Previous | Next |