Hi
Thanks for suggestion given in http://stackoverflow.com/questions/2327734/search-dataset-from-xml-file to use Xpath instead of dataset as in my previous post. I've successfully filtered my xml data (see previous post) using xpath but now I need to display data in a table. How do I do this? I would need to display certain values. How can I choose the nodes I want and display them?
Dim xdoc As New XPathDocument(xt)
Dim nav As XPathNavigator = xdoc.CreateNavigator()
Dim expr As XPathExpression = nav.Compile("pf:CONTRACTS/pf:CONTRACT[contains(pf:KEYWORDS,'" word "')]")
Dim tr As String = Nothing
Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(nav.NameTable)
namespaceManager.AddNamespace("pf", "http://namespace.co.uk/")
expr.SetContext(namespaceManager)
Dim nodes As XPathNodeIterator = nav.Select(expr)
While nodes.MoveNext()
'I would need to have "Contact ID", "Contract Name", etc.
tr += "<tr><td>" & nodes.Current.Value & "</td><td></td><td></td><td></td></tr>"
End While
Dim th As String = "<th>Commodity</th><th>Name</th><th>Supplier</th><th>Name</th>"
div1.InnerHtml = ("<table class='datatable1'>" & th) + tr & "</table>"