View Single Post
  #1 (permalink)  
Old February 27th, 2009, 05:57 AM
saisudrik saisudrik is offline
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parsing xml using vbscript

Hi,

I need to parse a particular node in an xml file to get all the nodes and childnodes of each node under a particular node.
Can anyone help me with the code?
I found a function on devguru.com and i have modified it a bit. But gives error 'Object not a collection' code: 800A01C3

Code:
Sub Drill(n) 
  msgbox(n.nodeName & "<br>") 
  cc = 0 
  while n.hasChildNodes 
    cc = cc + 1 
    set chd = n.childnodes 
    for each cld1 in chd 
      msgbox(cld1.nodeName) 
      for each att in cld1.attributes 
        msgbox(cld1.nodeName & " " & att.name & " " & att.value) 
      next 
      If cld1.nodeName = "AName" Then 
        msgbox("AName "& cld1.Text) 
      End If 
      Drill(cld1) 
    next 
  wend 
End Sub

Last edited by saisudrik; February 27th, 2009 at 06:02 AM..
Reply With Quote