Dim doc As XDocument = XDocument.Load("C:\test.xml") Dim contents1 = doc.<question>.<contents>.Where(Function(x) x.@no = 1) Dim q As String = contents1.<q>.Value Dim answer As String = contents1.<anser>.Value MsgBox(q & vbNewLine & answer)
Dim doc As New XmlDocument() doc.Load("C:\test.xml") Dim contents1 As XmlNode = doc.SelectSingleNode("/question/contents[@no='1']") Dim q As String = contents1.SelectSingleNode("q").InnerText Dim answer As String = contents1.SelectSingleNode("anser").InnerText