Solved

XPathDocument result to DataSource

Posted on 2003-11-06
1
258 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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