خرید بک لینک

در این پست قصد دارم با استفاده از کد #C محتوای یک فایل XML را بازیابی کنم:

1. فرض کنید یک فایل XML مثل چیزی که در زیر مشاهده میکنید در مسیر درایو D داریم:


<?xml version="1.0" encoding="utf-8"?>

<palyer>

<path></path>

<width></width>

<height></height>

</palyer>


2. از کد زیر برای اینکار استفاده میکنیم:

private void openXml()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("d:\props.xml");
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/palyer");
foreach (XmlNode node in nodeList)
{
path = node.SelectSingleNode("path").IerText;
widh1 = Convert.ToInt16(node.SelectSingleNode("width").IerText);
height1 = Convert.ToInt16(node.SelectSingleNode("height").IerText);
}
}
موفق باشید.
میلاد

برچسب: sample 504 plan,sample 5 paragraph essay,sample 500 calorie a day diet menu,sample 5 month old schedule,sample 504 plan for adhd,sample 501c3 donation letter,sample 504 plan for food allergies,sample 50th wedding aiversary invitations,sample 501c3 application,sample 504 plan for anxiety, نویسنده: آروین قنبری‌پور تاريخ: پنجشنبه 29 مهر 1395 ساعت: 17:54

صفحه بندی