On Fri, 20 Aug 2004 01:57:02 -0700, Madhu[C#-MVP] wrote:
Hi Mike,
Check this out...
This example uses XmlDataDocument to load the XML and then accessing the
data using dataset...
<http://samples.gotdotnet.com/quickstart/howto/doc/Xml/LoadDataSetXMLData.aspx>
Another alternative is using ReadXml method of the Dataset...
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconloadingdatasetfromxml.asp>
Hope this helps...
Cheers,
Madhu
"Mike P" wrote:
I'm currently reading data from an XML file using XPathNavigator and
XPathNodeIterator to select the subset of data that I want. I've never
using the XPath objects before so I'm not sure how to get this data into
a dataset.
XPathDocument doc = new
XPathDocument(@"C:\inetpub\wwwroot\test\test.xml") ;
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter =
nav.Select("/test/translation/engword[preceding-sibling::fraword = '" +
strFraWord + "']");
Can anybody help me out with this? Any assistance would be really
appreciated.
Cheers,
Mike
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
to extend the words of Madhu here is a snippet from an application of mine
which should help you, the second function is the one you should
concentrate on... this one is for ultimately populating a datagrid.
DataSet ds = ImportDataGrid.ImportSavedData();
if (ds != null) {
this.computerGrid.DataSource = ds;
} else {
this.updateMessageBox("There was a problem importing the data, the file
may not exist or there is a sytax error with the import file
(xml\\datagrid.xml)");
}
//ImportDataGrid.ImportSaveData()
public static DataSet ImportSavedData() {
DataSet ds = null;
try {
ds = new DataSet();
//this returns a (string)fileName located in the properties XML file.
ds.ReadXml(Properties.getString("data.location"));
} catch {
MessageBox.Show("The data file was not found, or it couldn't be
imported.", "File Not Found", MessageBoxButtons.OK,
MessageBoxIcon.Information);
} finally {
return ds;
}
}
HTH
Mike
http://www.blamires.co.uk/