Hi
The structure of my XML is
<Sales>
<sale>
<items>
<item>
<id>1</id>
<saleid>5</saleid>
</item>
<item>
<id>2</id>
<saleid>5</saleid>
</item>
</items>
</sale>
<sale>
<items>
<item>
<id>1</id>
<saleid>6</saleid>
</item>
<item>
<id>2</id>
<saleid>6</saleid>
</item>
<item>
<id>3</id>
<saleid>6</saleid>
</item>
</items>
</sale>
</sales>
Set obj = CreateObject("Msxml.domdocument")
obj.loadXML (xml)
I am looking for saleid in the xml
Set nodelist = obj.selectNodes("//saleid")
It returns me the length of nodelist as 5 because each item in xml has saleid but for each sale, there is same saleid. What I want is that it should return me unique saleid only i.e nodelist length should be 2 instaed of 5. I can not change the structure of my XML.
Then in VB, I loop through the nodes and pass saleid to another programe.
How do I loop through in VB and then get the value of saleid? I am doing
For i = 0 To i = (nodelist.length - 1)
SaleID = NodeValue
Next
There is something wrong in line
SaleID = NodeValue
Your help is much appreciated
Thanks
The structure of my XML is
<Sales>
<sale>
<items>
<item>
<id>1</id>
<saleid>5</saleid>
</item>
<item>
<id>2</id>
<saleid>5</saleid>
</item>
</items>
</sale>
<sale>
<items>
<item>
<id>1</id>
<saleid>6</saleid>
</item>
<item>
<id>2</id>
<saleid>6</saleid>
</item>
<item>
<id>3</id>
<saleid>6</saleid>
</item>
</items>
</sale>
</sales>
Set obj = CreateObject("Msxml.domdocument")
obj.loadXML (xml)
I am looking for saleid in the xml
Set nodelist = obj.selectNodes("//saleid")
It returns me the length of nodelist as 5 because each item in xml has saleid but for each sale, there is same saleid. What I want is that it should return me unique saleid only i.e nodelist length should be 2 instaed of 5. I can not change the structure of my XML.
Then in VB, I loop through the nodes and pass saleid to another programe.
How do I loop through in VB and then get the value of saleid? I am doing
For i = 0 To i = (nodelist.length - 1)
SaleID = NodeValue
Next
There is something wrong in line
SaleID = NodeValue
Your help is much appreciated
Thanks