الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Unable to show the value of the XmlElement

مغلق
بدأه IOException في 13 أكتوبر 2005 · 2 رد · 467 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

  private void button1_Click(object sender, System.EventArgs e)
  {
 	 XmlDocument doc=new XmlDataDocument();
 	 doc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?> "+
 	 "<Employees>"+
 	 "	<Employee>"+
 	 "  <EmplNumber>72-448</EmplNumber>"+
 	 "  <FirstName>Sylvie</FirstName>"+
 	 "  <LastName>Aronson</LastName>"+
 	 "  <salary>25.64</salary>"+
 	 "	</Employee>"+
 	 "	<Employee>"+
 	 "  <EmplNumber>84-502</EmplNumber>"+
 	 "  <FirstName>Bertrand</FirstName>"+
 	 "  <LastName>Yamaguchi</LastName>"+
 	 "  <salary>16.38</salary>"+
 	 "	</Employee>"+
 	 "	<Employee>"+
 	 "  <EmplNumber>68-335</EmplNumber>"+
 	 "  <FirstName>Anselme</FirstName>"+    
 	 "  <LastName>Bean</LastName>"+
 	 "  <salary>22.82</salary>"+
 	 "	</Employee>"+
 	 "</Employees>");
 	 XmlNodeList f=doc.GetElementsByTagName("Employee");
 	 foreach(XmlNode a in f)
 	 {
    XmlNodeList m=a.ChildNodes;
    foreach(XmlNode i in m)
   	 MessageBox.Show(i.Value);
 	 }

  }

the main problem here that the messagebox doesn't display any thing.

the program doesn't produce errors but The messagebox is shown and doesn't display anything

I even tried to display only one item in the messagebox and nothing changed

XmlNodeList f=doc.GetElementsByTagName("Employee");
 	 XmlNode a=f[1];
 	 XmlNode m=a.ChildNodes[1];
 	 MessageBox.Show(m.Value);

يا ريت يا جماعه حد يقول لى المشكله فى ايه!!

و جزاكم الله خيرا

#2

استخدام Value مع XmlNode من نوع Element ترجع null .. راجع الصفحة

http://msdn.microsoft.com/library/default....svaluetopic.asp

استخدم InnerText او InnerXml في مثالك وسوف تحصل على ماتريد ..

Coding on the Cloud and for the Cloud!

My Blog

#3

جزاك الله خيرا كثيرا

هذا الموضوع مغلق.

مواضيع مشابهة