lutt
asked on
xml nodelist problem
I have this code:
for each IXMLDOMNode in IXMLDOMNodelist
console.write(IXMLDOMNode. nodename)
next
why it gives an infinite loop showing only the first nodename in the nodelist? Confused. The nodelist contains more than one node. Thanks.
for each IXMLDOMNode in IXMLDOMNodelist
console.write(IXMLDOMNode.
next
why it gives an infinite loop showing only the first nodename in the nodelist? Confused. The nodelist contains more than one node. Thanks.
ASKER
I just want to show it is a node type.
I did just as what you suggested. By the way, I use MSXML3.0 in .NET.
I did just as what you suggested. By the way, I use MSXML3.0 in .NET.
Why not just use a conventional for loop
dim i as integer
dim nl as IXMLDOMNodeList
for i = 1 to nl.Count
console.write(nl[i].nodena me)
next
Also consider upgrading to v4. It's possble there is something wrong with v3 in this area.
dim i as integer
dim nl as IXMLDOMNodeList
for i = 1 to nl.Count
console.write(nl[i].nodena
next
Also consider upgrading to v4. It's possble there is something wrong with v3 in this area.
sorry have C# on the brain. Should be..,
for i = 1 to nl.Count
console.write(nl(i).nodena me)
next
for i = 1 to nl.Count
console.write(nl(i).nodena
next
ASKER
The conventional loop did work, but why for each loop doesn't work?
some examples use for each loop. Could you give more detail why for each loop doesn't work? Thanks.
some examples use for each loop. Could you give more detail why for each loop doesn't work? Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this...
Dim n as IXMLDOMNode
for each n in IXMLDOMNodelist
console.write(n.nodename)
next