[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

Treewalker for MSXML2 in VB6

Steffen Leppert

7/27/2010 4:05:00 PM

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
3 Answers

Paul Clement

7/27/2010 6:01:00 PM

0

On Tue, 27 Jul 2010 18:04:39 +0200, Steffen Leppert <st.leppert@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....


Paul
~~~~
Microsoft MVP (Visual Basic)

Steffen Leppert

7/27/2010 6:20:00 PM

0

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

Steffen Leppert

7/28/2010 4:10:00 AM

0

220 0 <OrV8jrgLLHA.5700@TK2MSFTNGP04.phx.gbl>
Date: Wed, 28 Jul 2010 06:10:20 +0200
From: Steffen Leppert <st.leppert@gmx.de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1
MIME-Version: 1.0
Subject: Re: Treewalker for MSXML2 in VB6
References: <O4ujDWaLLHA.6128@TK2MSFTNGP06.phx.gbl> <kl7u46lmkqimsgql85dckpc7ubqg3gr5e3@4ax.com> <ekoBxhbLLHA.3496@TK2MSFTNGP05.phx.gbl>
In-Reply-To: <ekoBxhbLLHA.3496@TK2MSFTNGP05.phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <OrV8jrgLLHA.5700@TK2MSFTNGP04.phx.gbl>
Newsgroups: microsoft.public.vb.general.discussion
NNTP-Posting-Host: p54AD324E.dip.t-dialin.net 84.173.50.78
Lines: 1
Path: s05-b41.iad!s04-b166.am1!squishee.iad!txtbe01.phx!txtbe01.iad!npeersf02.iad.highwinds-media.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!feeder.erje.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!TK2MSFTFEEDS02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl
X-Received-Date: Wed, 11 May 2011 09:26:04 UTC (s05-b41.iad)

Resolved:

I made a typing error.