Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 21st, 2006, 09:55 AM
Registered User
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Read XML to DataSet with XPath?

Please, Please help, this is really driving me crazy

I am trying to read the contents of an XML file, filter the results with XMLNodeReader & XPath and then save them to a DataSet ready for binding in my page.

The problem is that I can only seem to return one result using SelectSingleNode, as SelectNodes creates an XMLNodeList which XMLNodeReader doesn't like.

I get 'XMLNodeList cannot be converted to XMLNode'

Can anyone help, even if its a work around to get my filtered data into a DataSet. Thanks in Advance.

Here's the code.

        Dim docReader As New XmlDocument

        Dim nodeList As XmlNodeReader = New XmlNodeReader_

        Dim docDataSet As New DataSet

        RSSXMLDataList.DataSource = docDataSet.Tables(0).DefaultView

Old July 25th, 2006, 03:30 AM
Registered User
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

I got around this by setting the XML to a dataset and then the dataset to a dataview where i could sort, filter and all the rest of it.

        Dim ds As DataSet = New DataSet
        Dim view As DataView

        view = ds.Tables("item").DefaultView
        view.RowFilter = "category = 'True'"
        If view.Count = 0 Then
            rssPanel.Visible = True
            RSSXMLDataList.DataSource = view
        End If

Similar Threads
Thread Thread Starter Forum Replies Last Post
read nested xml into a dataset sansircar ASP.NET 1.0 and 1.1 Professional 0 August 1st, 2006 03:08 PM
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM
Read xpath query from node value jaquing XSLT 2 January 11th, 2006 06:50 PM
XSLT read through XML to transform another XML dendenx2 XSLT 8 July 7th, 2005 08:18 PM
code to read in Access tables to a dataset - hlp! ruairi ADO.NET 4 February 12th, 2005 06:03 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.