473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

loading XML into a dataset

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!
Nov 12 '05 #1
2 2706


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.


If you want to have the data in a dataset I think you should better use
XmlDataDocument as that has a synchronized DataSet property that you can
then use.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
I'm finding loads of examples on the net like this, which show you how
to get the data that you want from the XML file, but have no mention of
datasets. Do you have a good example of how to do this?

XmlDataDocument mydocument = new XmlDataDocument();;
//Load your Xml document
mydocument.Load(Server.MapPath("EmpList.xml"));

//Use "SelectNodes" to get the Employee node where the attribute
"id=3"
//and write out the response.
XmlNodeList xmln =
this.mydocument.SelectNodes("//Employee[@id='3']");
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Patrick J. Schouten | last post by:
I am trying to transfor an XML document prior to loading into a Dataset. My problem stems from the known bug in Visual Studio that prevents loading a well formed XML because of duplicate child...
3
by: Mauricio Correa L. | last post by:
Hello, i have a string with a XML inside, but when a try lo load a dataset with the next code. Dim all As String = Webservice.getName(TextName.Text, TextNo2.Text).ToString 'this webmethod return...
0
by: J-T | last post by:
I have a CSV file which contains comma seperated data that I need to validate against our database.I was thinking about loading that CSV file into a Typed-Dataset which has our database schema in...
1
by: kids_pro | last post by:
I had come across a code block from Loading a DataSet from XML (.NET Framework Developer's Guide) ---------------------------------------- NOte If you call ReadXML to load a very large file, you...
4
by: Fred Nelson | last post by:
I have an applicatioin that I'm writing that uses a "case" file that contains over 350 columns and more may be added in the future. I would like to create a dataset with all the column names and...
4
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I...
7
by: koonda | last post by:
Hi guys, I am trying to create a web interface in C# using ASP.NET. The database being used is SQL Server. I have some problems loading the tables in the datalist controls. When I run the program...
0
by: Chris | last post by:
Hello, I have a problem with re-loading datasets. As a simple example, if I have an SQL table of addresses comprising active and inactive addresss, I wish to load either sub-set by clicking on...
6
by: cmorgan76 | last post by:
This is a 2 part question: Part 1: I am accesing a web service that returns an xml string of user information. I am attempting to load the XML into an XMLDocument, save the document, load it...
2
by: TexasAggie96 | last post by:
I am working on a project where I get a XML datastream back from an application API which may contain a particular value that may be emty. An example of this can be seen below <?xml...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.