XPath kullanarak belirli bir attribute’a sahip node’u bulmak
Elimizde kullanıcıların olduğu bir XML dosyası olduğunu ve ID’si 4 olan kullanıcıyı bulmak istediğinizi düşünelim. XPath sorgunuz aşağıdakine benzer bir şekilde olmalıdır.
<kullanicilar>
<kullanici id="1" isim="Ahmet" />
<kullanici id="2" isim="Mehmet" />
<kullanici id="3" isim="Ali" />
<kullanici id="4" isim="Coskun" />
</kullanicilar>
XmlDocument m_XmlDocument = new XmlDocument();
m_XmlDocument.Load("~/App_Data/data.xml");
XmlNode node = m_XmlDocument.SelectSingleNode( "//kullanicilar/kullanici[@id='4']" );
| Print article | This entry was posted by Coskun SUNALI on 13 Jun 2007 - Wed at 11:36, and is filed under General. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |