XmlTextReader xmlDocument = new XmlTextReader("MyXmlFile.xml"); while (xmlDocument.Read()) Console.WriteLine(IpAdres ); |
*XmlTextReader xmlDocument = new XmlTextReader("TcpServer.xml");
At this sentence you just defined your stream for reading xml and set it’s parameter which is about file path .
*while (xmlDocument.Read()) after defined your stream, you can start reading the first line of your file
*xmlDocument.NodeType == XmlNodeType.Element At this part of code you just verify your node type for sure it not root node. And then you can use switch to take your node name .
* when you found which name you search you could read that line and convert which type you want same this => _IpAdres = Convert.ToString(xmlDocument.ReadString());
1 yorum:
selam, tüm gece uğraştım fakat nedenini bulamadım. sen bloğunda bundan bahsedince yardımın olabileceğini düşündüm.
bir windows formu kaydedip tekrar yükleyebilmek için xml kullanıyorum. kayıt ederken gayet mükemmel bir xml yaratıyorum fakat okurken sorun yaşıyorum.
okumada "if (xmlDocument.NodeType == XmlNodeType.Element)" satırından sonra switch-case'leri atlıyor.
xml'imin yapısı aşağıdaki örneğe benziyor;
veli
kemal
hasan
mustafa
umarım anlatabilmişimdir.
yardımcı olabilirsen sevinirim.
mail adresim boragok@yahoo.com
Yorum Gönder