IXMLDOMNode.attributes (Visual Basic .NET)
Previous | Next |
IXMLDOMNode.attributes (Visual Basic .NET)
The attributes property contains the list of attributes for this node.
Syntax
IXMLDOMNamedNodeMap = IXMLDOMNode.attributes
Remarks
The property is read-only. It returns an IXMLDOMNamedNodeMap object for nodes that can return attributes. It returns NULL for all other node types. For the valid node types, an IXMLDOMNamedNodeMap object is always returned; when there are no attributes on the element, the list length is set to zero.
The value of the IXMLDOMNamedNodeMap object that is returned depends on the type of node on which the attributes property is called, as shown in the following table. For example, if the node type is NODE_ELEMENT, an IXMLDOMNamedNodeMap object is returned containing a list of attribute nodes for that element node.
Node type | Value returned |
NODE_ATTRIBUTE NODE_COMMENT NODE_DOCUMENT NODE_TEXT |
Always returns NULL. |
NODE_ELEMENT | Returns an IXMLDOMNamedNodeMap object that contains a list of nodes corresponding to the attributes of the element. |
NODE_PROCESSING_INSTRUCTION | Returns NULL for all processing instructions except the XML declaration; for example,
<?xml version="1.0" encoding="windows-1252" standalone="yes" ?>. For the XML declaration, the version, encoding, and stand-alone specifications can be accessed as attributes from the corresponding node. |
Example Code
The following creates an IXMLDOMNamedNodeMap object from a document's attributes property, and then displays the number of nodes in the object.
Imports interop_msxml Imports Microsoft.WindowsMediaServices.Interop On Error GoTo Err ' Declare variables. Dim Server As New WMSServerClass() Dim Playlist As IXMLDOMDocument Dim oNamedNodeMap As IXMLDOMNamedNodeMap ' Create a new playlist object. Set Playlist = Server.CreatePlaylist ' Load a playlist. Playlist.Load ("file://c:\wmpub\wmroot\simple.wsx") Set oNamedNodeMap = Playlist.documentElement.firstChild.Attributes MsgBox oNamedNodeMap.length 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
- IXMLDOMNamedNodeMap Object (Visual Basic .NET)
- IXMLDOMNode Object (Visual Basic .NET)
- XML DOM Properties (Visual Basic .NET)
Previous | Next |