XML > Dataset. Please, I need help. Thank You.

S

Shapper

Hello,

I have a XML file that includes the node <item>:
....
<title>...</title>
<url>...</url>
<item>
<title>title 01</title>
<description>description 01</description>
</item>
<item>
<title>title 02</title>
<description>description 02</description>
</item>
....
How to get all title and description values into a dataset or
datareader?

Thank You,
Miguel
 
C

Craig Deelsnyder

Shapper said:
Hello,

I have a XML file that includes the node <item>:
...
<title>...</title>
<url>...</url>
<item>
<title>title 01</title>
<description>description 01</description>
</item>
<item>
<title>title 02</title>
<description>description 02</description>
</item>
...
How to get all title and description values into a dataset or datareader?

Thank You,
Miguel

For a dataset, if you don't have a schema to give to it, you can tell it
to infer a schema (assuming your xml does follow the format a dataset
normally 'uses'):

http://samples.gotdotnet.com/quickstart/howto/doc/Xml/DataSetMapXMLData.aspx

if you had the schema:

http://samples.gotdotnet.com/quickstart/howto/doc/Xml/LoadDataSetXMLData.aspx

a general primer on the subject:

http://samples.gotdotnet.com/quickstart/howto/doc/Xml/XMLDataSet.aspx
 
S

Shapper

Hello,

I know dataset.readxml gets all the data from the xml file and places it
in the dataset. The problem is I don't want to take all data from the
XML file.
I only want to take the data which is inside the <item> nodes.

You can see in my XML file example I have some nodes, for example,
<title> and <url> which I don't want to place in the dataset.

I can't understand how to do this.

Can someone help me out?

Thanks,
Miguel
 
G

Guest

Hi,

DataSet.Reaxml has a overload called DataSet.ReadXml(XmlReader).
This XmlReader can be a XmlNodeReader. Use this node reader to read the
specific node in the xml file and pass it to ReadXML. I am sorry. I don't
have the time to write the code for you.[If this answer helps you, please
click "Yes" in "Was this post helpful to you?" link]

Prakash.NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top