I'm using MSXML3.0 for VB...
I have an XML of this sort...
<root>
<product>
<name>blah</name>
<instance id="1" active="true">
...
...
</instance>
<instance id="2" active="false">
...
</instance>
</product>
<product>
...
...
</product>
</root>
And I'm fine getting into the right product, but once there I'd like to find the instance with the highest id where the active="true"...
As it stands, I'm looping through the attributes and if their NodeName = "id" then I read it, and such.
My problem is that to do this I make a call to
node.Item(x).Attributes(0).nodeName
and then
node.Item(x).Attributes(0).text
and so on.... what worries me is the 0... I don't like having to worry about the order of my attributes and the fact that stuff is 0 indexed etc... I know I could loop through the whole list of attributes first (which is where I'm headed)... but this seems silly innacurate... what I'm hoping for is something like...
id = node.Item(x).Attributes("id"
.text
Is there anyway to do this?
Thanks,
Rob
I have an XML of this sort...
<root>
<product>
<name>blah</name>
<instance id="1" active="true">
...
...
</instance>
<instance id="2" active="false">
...
</instance>
</product>
<product>
...
...
</product>
</root>
And I'm fine getting into the right product, but once there I'd like to find the instance with the highest id where the active="true"...
As it stands, I'm looping through the attributes and if their NodeName = "id" then I read it, and such.
My problem is that to do this I make a call to
node.Item(x).Attributes(0).nodeName
and then
node.Item(x).Attributes(0).text
and so on.... what worries me is the 0... I don't like having to worry about the order of my attributes and the fact that stuff is 0 indexed etc... I know I could loop through the whole list of attributes first (which is where I'm headed)... but this seems silly innacurate... what I'm hoping for is something like...
id = node.Item(x).Attributes("id"
Is there anyway to do this?
Thanks,
Rob