xml - getting all nodes of the same type -


i trying nodes of type erad long list of erad nodes found in xml

here code first erad item

how change erads each item. xml regular repeating pattern

sub macro1() dim strurl string dim strxpathbase string  dim objdoc object set objdoc = createobject("msxml2.domdocument")  strurl = "https://....xml"  objdoc.async = false objdoc.load strurl  strxpathbase = "//response/responsebody/responselist/item/" debug.print "erad1: " & objdoc.selectsinglenode(strxpathbase & "erad1").text   set objdoc = nothing end sub 

simply iterate off parent, <item> , print child nodes <erad1>. below uses binding of msxml objects:

sub macro1()      dim strurl string     dim strxpathbase string       ' add vba reference: microsoft xml, v6.0 '     dim objdoc new msxml2.domdocument60     dim itemnode msxml2.ixmldomnodelist     dim variant      strurl = "https://....xml"      objdoc.async = false     objdoc.load strurl      strxpathbase = "//response/responsebody/responselist/item"         set itemnode = objdoc.documentelement.selectnodes("strxpathbase")      each in itemnode         debug.print "erad1: " & i.selectsinglenode("erad1").text     next      set itemnode = nothing     set objdoc = nothing  end sub 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -