I\'d like to change the tag name of a MSXML XMLDOMElement, but unfortunately the nodeName property is read-only. Is there any straightforward way to do it, or have
Just for reference, I ended up with a replace function which is copying all children to a newly created node: (VB6 sample code)
Private Sub ReplaceNodeName(oDoc As DOMDocument, oElement As IXMLDOMElement, newName As String)
Dim ohElement As IXMLDOMElement
Dim sElement As IXMLDOMElement
Dim oChild As IXMLDOMNode
' search the children '
If Not oElement Is Nothing Then
Set ohElement = oElement.parentNode
Set sElement = oDoc.createElement(newName)
For Each oChild In oElement.childNodes
Call sElement.appendChild(oChild)
Next
Call ohElement.replaceChild(sElement, oElement)
End If
End Sub