Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<sehirlistesi>
<sehir>ISTANBUL
<sehir>ANKARA
<sehir>ADANA
<sehir>ADIYAMAN
<sehir>AFYON
<sehir>AGRI
<sehir>AKSARAY
<sehir>AMASYA
<sehir>ANTALYA
<sehir>ARDAHAN
<sehir>ARTVIN
<sehir>AYDIN
<sehir>BALIKESIR
<sehir>BARTIN
<sehir>BATMAN
<sehir>BAYBURT
<sehir>BILECIK
<sehir>BINGOL
<sehir>BITLIS
<sehir>BOLU
<sehir>BURDUR
<sehir>BURSA
<sehir>CANAKKALE
<sehir>CANKIRI
<sehir>CORUM
<sehir>DENIZLI
<sehir>DIYARBAKIR
<sehir>DUZCE
<sehir>EDIRNE
<sehir>ELAZIG
<sehir>ERZINCAN
<sehir>ERZURUM
<sehir>ESKISEHIR
<sehir>GAZIANTEP
<sehir>GIRESUN
<sehir>GUMUSHANE
<sehir>HAKKARI
<sehir>HATAY
<sehir>IGDIR
<sehir>ISPARTA
<sehir>IZMIR
<sehir>KAHRAMANMARAS
<sehir>KARABUK
<sehir>KARAMAN
<sehir>KARS
<sehir>KASTAMONU
<sehir>KAYSERI
<sehir>KILIS
<sehir>KIRIKKALE
<sehir>KIRKLARELI
<sehir>KIRSEHIR
<sehir>KOCAELI
<sehir>KONYA
<sehir>KUTAHYA
<sehir>MALATYA
<sehir>MANISA
<sehir>MARDIN
<sehir>MERSIN
<sehir>MUGLA
<sehir>MUS
<sehir>NEVSEHIR
<sehir>NIGDE
<sehir>ORDU
<sehir>OSMANIYE
<sehir>RIZE
<sehir>SAKARYA
<sehir>SAMSUN
<sehir>SANLIURFA
<sehir>SIIRT
<sehir>SINOP
<sehir>SIRNAK
<sehir>SIVAS
<sehir>TEKIRDAG
<sehir>TOKAT
<sehir>TRABZON
<sehir>TUNCELI
<sehir>USAK
<sehir>VAN
<sehir>YALOVA
<sehir>YOZGAT
<sehir>ZONGULDAK
Posted
Comments
Wendelius 29-Dec-12 17:07pm    
The list you posted isn't XML but just a lost of text. Where is it stored? In a file? Do you need to get the list from file or something else?
ct_12 29-Dec-12 17:10pm    
Im sorry there was a mistake , here is the url http://www.namaz.web.tr/namazVakitleriApi.php?ilListesi=1
Sergey Alexandrovich Kryukov 29-Dec-12 21:39pm    
There is no XML here.
—SA

1 solution

One way is to load the data into a XmlDocument and then extract the nodes using the tag.

The following example has the data embedded directly in the code, but I take it you should first fetch it from somewhere else. Note that the list is only partial to prevent too long code example:
C#
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
         xmlDoc.LoadXml(@"
<sehirListesi>
<sehir>ISTANBUL</sehir>
<sehir>ANKARA</sehir>
<sehir>ADANA</sehir>
<sehir>ADIYAMAN</sehir>
<sehir>AFYON</sehir>
<sehir>BAYBURT</sehir>
<sehir>BILECIK</sehir>
<sehir>BINGOL</sehir>
<sehir>BITLIS</sehir>
<sehir>BOLU</sehir>
<sehir>BURDUR</sehir>
<sehir>BURSA</sehir>
<sehir>CANAKKALE</sehir>
<sehir>CANKIRI</sehir>
<sehir>CORUM</sehir>
<sehir>DENIZLI</sehir>
<sehir>KUTAHYA</sehir>
<sehir>SIRNAK</sehir>
<sehir>SIVAS</sehir>
<sehir>TEKIRDAG</sehir>
<sehir>TOKAT</sehir>
<sehir>TRABZON</sehir>
<sehir>TUNCELI</sehir>
<sehir>USAK</sehir>
<sehir>VAN</sehir>
<sehir>YALOVA</sehir>
<sehir>YOZGAT</sehir>
<sehir>ZONGULDAK</sehir>
</sehirListesi>");
         foreach (System.Xml.XmlNode node in xmlDoc.GetElementsByTagName("sehir")) {
            System.Diagnostics.Debug.WriteLine(node.InnerText);
         }
 
Share this answer
 
v2
Comments
Espen Harlinn 30-Dec-12 8:09am    
5'ed!
Wendelius 4-Jan-13 15:13pm    
Thanks :D

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900