?
Solved

XPathDocument result to DataSource

Posted on 2003-11-06
1
Medium Priority
?
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
_ys_ earned 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

801 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