0
我想通過一個XML循環,並把節點放入一個gridview。循環通過一個XML並添加到一個gridview
這是我使用的代碼:
Dim iCustomer As XPathNodeIterator = nav.Select(nav.Compile("//Content"))
While iCustomer.MoveNext() ' Loop through all customer nodes
' NOW you can get those child nodes
Dim Title As XPathNodeIterator = iCustomer.Current.SelectChildren("Title", "")
Dim iName As XPathNodeIterator = iCustomer.Current.SelectChildren("QuickLink", "")
Dim iContact As XPathNodeIterator = iCustomer.Current.SelectChildren("Teaser", "")
If Title.Count <> 0 Then ' If a node is found....
' You *might* have to call iListID.MoveNext() here
Title.MoveNext()
NewRow("Content_Title") = Title.Current.Value
' ListID = iListID.Current.Value ' ... set the value to the string
End If
' Do the above for each other value
End While
我只得到補充的最後一個節點,我怎麼能輸出匹配的節點。