تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] مساعدة في قراءة ملف xml موجود في موقعي
#5
(19-05-17, 11:29 PM)alma2 كتب : ضع الكود كامل الذي أنشأت به ملف xml

الملف منشة من قبل موقع اخر 

ما عندي فكرة عنه

بس انا الكود اللي عندي شغال بس ما يسحب جميع الاسطر المطلوبه

كود :
   Dim url As String = String.Format("https://www.hamqth.com/xml.php?id={0}&callsign={1} &prg=BKLOG", Label17.Text, calls.Text)

       Dim document As New XmlTextReader(url)

       'loop through the xml file
       While (document.Read())
   

           Dim type = document.NodeType

           'if node type was element
           If (type = XmlNodeType.Element) Then

               'if the loop found a <FirstName> tag
               If (document.Name = "adr_name") Then

                   Lfullname.Text = document.ReadInnerXml

               End If
               If (document.Name = "us_state") Then

                   state.Text = document.ReadInnerXml

               End If
               'if the loop found a <FirstName> tag
               If (document.Name = "qth") Then

                   qth.Text = document.ReadInnerXml

               End If


               'if the loop found a <FirstName> tag
               If (document.Name = "grid") Then

                   WORKinfo.GRIDSQUARE.Text = document.ReadInnerXml

               End If

               'if the loop found a <FirstName> tag
               If (document.Name = "qsl_via") Then

                   WORKinfo.Lqslmgr.Text = document.ReadInnerXml

               End If

               'if the loop found a <FirstName> tag
               If (document.Name = "latitude") Then

                   WORKinfo.LAT.Text = document.ReadInnerXml

               End If

               'if the loop found a <FirstName> tag
               If (document.Name = "longitude") Then

                   WORKinfo.LON.Text = document.ReadInnerXml

               End If

           End If

       End While

   End Sub


يسحب اول ثلاث اسطر

كود :
             'if the loop found a <FirstName> tag
               If (document.Name = "adr_name") Then

                   Lfullname.Text = document.ReadInnerXml

               End If
               If (document.Name = "us_state") Then

                   state.Text = document.ReadInnerXml

               End If
               'if the loop found a <FirstName> tag
               If (document.Name = "qth") Then

                   qth.Text = document.ReadInnerXml

               End If


وهذا الملف
   

(19-05-17, 11:39 PM)alma2 كتب : تستطيع استغلال DataSet وعرضها في DataGridView مع تحديد اسم الجدول وهو هنا Callsign حسب طلبك
كود :
       Dim ds As New DataSet
       ds.ReadXml(url)
       Me.DataGridView1.DataSource = ds.Tables("Callsign")


تسلم استاذي  بس
انا محتاج اعرض النتائج في 
textbox
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع


التنقل السريع :


يقوم بقرائة الموضوع: