extracing atribute - how to?

webmasterbeta

New Member
Hi

I have following XML file:

===========================
- <CountriesCities>
- <Countries>
<CoID>111</CoID>
<Country>ALBANIA</Country>
<Cities CiID="1478" City="TIRANA" />
</Countries>
- <Countries>
<CoID>1</CoID>
<Country>AUSTRALIA</Country>
<Cities CiID="1" City="ADELAIDE" />
<Cities CiID="4" City="MELBOURNE" />
<Cities CiID="6" City="SYDNEY" />
</Countries>
- <Countries>
=============================

Using this Code:

=============================
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load Server.MapPath("../test/countries.xml")
varCountry = 1

set nodes=objXMLDoc.selectNodes("/CountriesCities/Countries[CoID='"&varCountry&"']")

for each x in nodes
response.write(x.xml) & "<br>"
next
=============================

When varCountry = 1
I get this result:

1 AUSTRALIA

If the varCountry is 111
I get this result:

111 ALBANIA

=============================

I would like to get if varCountry = 1

1 ADELAIDE
4 MELBOURNE
6 SYDNEY

and If VarCountry = 111

1478 TIRANA

Anyone can point me in some direction?

Regards, Zoreli
 
Back
Top