From: Steffen Leppert on 27 Jul 2010 12:04 Hello! Is there anybody here who has created a treewalker class for the MSXML2 library in VB6? I have a Java project here which uses Xerces for XML handling. In this code I see that a treewalker is used to iterate through the nodes, but I am afraid that I don't really understand it yet. I cannot run the Java code, so I have to re-write this code without being able to check if I can produce the same results. If somebody already did something like that, can he please tell me? Have a nice day! Steffen Leppert
From: Paul Clement on 27 Jul 2010 14:01 On Tue, 27 Jul 2010 18:04:39 +0200, Steffen Leppert <st.leppert(a)gmx.de> wrote: � Hello! � � Is there anybody here who has created a treewalker class for the MSXML2 � library in VB6? � � I have a Java project here which uses Xerces for XML handling. � In this code I see that a treewalker is used to iterate through the � nodes, but I am afraid that I don't really understand it yet. I cannot � run the Java code, so I have to re-write this code without being able to � check if I can produce the same results. � � If somebody already did something like that, can he please tell me? � � Have a nice day! � Steffen Leppert How about the following... http://www.vbrad.com/article.aspx?id=76 Paul ~~~~ Microsoft MVP (Visual Basic)
From: Steffen Leppert on 27 Jul 2010 14:20 Okay, looks good, thanks, but an intermediate question, please... I think the code below is relatively easy to read. Do you have any idea what I'm doing wrong? Some nodes are not debug.print'ed. In the code you gave me, they ARE shown. I guess I am missing something obvious here... Private sub pStart Dim Doc As MSXML2.DOMDocument60 Set Doc = New MSXML2.DOMDocument60 Doc.async = False Call Doc.Load("C:\myfile.xml") Dim first As MSXML2.IXMLDOMElement Set first = Doc.documentElement.firstChild Call pList(first, "") End Sub Private Sub pList(ByVal uNode As MSXML2.IXMLDOMNode, ByVal uTab As String) DoEvents If Not uNode.hasChildNodes Then Exit Sub End If Dim child As MSXML2.IXMLDOMNode For Each child In uNode.childNodes Debug.Print uTab & "Node Name: " & uNode.nodeName & ", Value: " & uNode.nodeValue Dim a As MSXML2.IXMLDOMAttribute For Each a In uNode.Attributes Debug.Print uTab & "Attribute Name: " & a.Name & ", Value: " & a.Value Next a If child.hasChildNodes Then 'call recursively pList child, uTab & vbTab End If Next child End Sub
From: Steffen Leppert on 28 Jul 2010 00:10 Resolved: I made a typing error.
|
Pages: 1 Prev: Creation Date Next: How to display 4 order Polynomial equation from the Excel in V |