Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6
I am successfully parse an xml file with this code.
The code is returning all value for the normal tags, but not for the lists.
IE: I get all the value for 1,2,3 & 5 but never for 4
Hope this is clear enough
 
Public Function GetNodeValue(ByRef Nodes As MSXML2.IXMLDOMNodeList) As String
Dim xNode As MSXML2.IXMLDOMNode
For Each xNode In Nodes
If xNode.nodeType = NODE_TEXT Then
GetNodeValue = xNode.parentNode.nodeName & ":" & xNode.nodeValue
Select Case xNode.parentNode.nodeName
Case "1"
Debug.Print xNode.nodeValue
Case "2"
Debug.Print xNode.nodeValue
Case "3"
Debug.Print xNode.nodeValue
Case Else
'This line never returns a value
Debug.Print xNode.nodeValue
End Select
End If
If xNode.hasChildNodes Then
GetNodeValue xNode.childNodes
End If
Next
Set xNode = Nothing
End Function
 
Here is an example of the XML:
 <domain:STUFF>
<1>00000000000017</1>
<2>000</2>
<3>Hmmmmm</3>
<4>
<domain:flag sysid="2"/>
</4>
<5>1.000</5>
</domain:STUFF>
<domain:STUFF>
<1>00000000000020</1>
<2>000</2>
<3>BOB2</3>
<4>
<domain:flag sysid="2"/>
<domain:flag sysid="4"/>
<domain:flag sysid="5"/>
<domain:flag sysid="6"/>
<domain:flag sysid="7"/>
<domain:flag sysid="8"/>
</4>
<5>1.000</5>
</domain:STUFF>
Posted 18-Apr-10 8:39am
xardoz393

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 598
1 George Jonsson 268
2 OriginalGriff 215
3 CPallini 210
4 PIEBALDconsult 155
0 OriginalGriff 5,835
1 Sergey Alexandrovich Kryukov 5,263
2 CPallini 4,750
3 George Jonsson 3,227
4 Gihan Liyanage 2,487


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 26 Apr 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100