Solved

XPathDocument result to DataSource

Posted on 2003-11-06
1
255 Views
Last Modified: 2012-08-14
Hi,

I use an XPathDocument class for filter any Xml data. I using the XPathNavigator, XPathNodeIterator too.
How can I transfer the selected result to a DataSource?
Currently I write a temporaly Xml file and read it into a DataSource, this is not a brilliant way. :-(

Have anyboody got other best idea?

Thank you,
0
Comment
Question by:stonecastle
1 Comment
 
LVL 9

Accepted Solution

by:
_ys_ earned 100 total points
ID: 9694128
Try using the XmlDataDocument class, instead of the XPathDocument class. (System.Xml namespace)

It supports XPathNavigator etc. But it also supports IEnumerable, and can therefore be used directly as a DataSource.


//Create an XmlDataDocument.
XmlDataDocument doc = new XmlDataDocument();

//Load the schema file.
doc.DataSet.ReadXmlSchema("source.xml");

//Load the XML data.
doc.Load("source.xml");


ReadXmlSchema and Load have overloaded declarations. Whatever means you're using currently to populate your XPathDocument will no doubt be reusable here.
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question