PDA

Click to See Complete Forum and Search --> : Adding an attribute using MSXML 2.6


swex
Feb 6th, 2001, 08:54 AM
Does anyone know of any snippets of code to add an attribute to an element using the MSXML 2.6? My production environment is standardized on it and MSDN now only supports MSXML 3.0 (msxml2.dll)

Thanks in advance for any help you can offer.

-Simon

tumblingdown
Feb 8th, 2001, 12:34 AM
Can you not just use setNamedItem? i.e.


Dim d As MSXML2.DOMDocument
Dim e As MSXML2.IXMLDOMElement
Dim a As MSXML2.IXMLDOMAttribute

Set d = New MSXML2.DOMDocument
Set e = d.createElement("E1")
Set a = d.createAttribute("A1")
a.nodeValue = "v1"
e.Attributes.setNamedItem a


td.