Results 1 to 1 of 1

Thread: UPDATED! deleting xml attributes

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    1

    Unhappy UPDATED! deleting xml attributes

    I am writing a script to delete all of the null valued xml attributes in every xml file in a directory. I am having trouble with my function to delete the attributes. This is what I have so far:

    Function RemoveNullAttributes (xmlSource) ' As Integer
    ' Return Values:
    ' 0 the file opened but was not updated
    ' 1 the file was updated
    ' 2 an error occurred
    Dim document ' As DOMDocument
    Dim node ' As IXMLDOMNode
    Dim root ' As IXMLDOMElement
    Dim oNodeList ' As IXMLDOMNodeList

    Dim myVar ' As Variant
    Dim lngAttNumber: lngAttNumber = 0 ' As Long
    Dim i ' As Integer
    Dim j: j = 0 ' As Integer

    Set document = CreateObject("Msxml2.DOMDocument")
    document.setProperty "SelectionLanguage", "XPath"
    document.async = False

    If document.Load (xmlSource) = True Then
    Set root = document.documentElement
    Set oNodeList = root.childNodes
    For Each node In oNodeList
    Set Node = root.childNodes.Item(0)
    If Node.nodeTypeString = "element" Then
    MsgBox Node.nodeType
    End If
    Next

    Any help would be greatly appreciated. Thanks!
    Last edited by dexteb01; Nov 7th, 2002 at 11:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width