Click here to Skip to main content
12,998,423 members (86,937 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
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
Set xNode = Nothing
End Function

Here is an example of the XML:
<domain:flag sysid="2"/>
<domain:flag sysid="2"/>
<domain:flag sysid="4"/>
<domain:flag sysid="5"/>
<domain:flag sysid="6"/>
<domain:flag sysid="7"/>
<domain:flag sysid="8"/>
Posted 18-Apr-10 8:39am

1 solution

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 26 Apr 2010
Copyright © CodeProject, 1999-2017
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