?
Solved

XML reading in C#

Posted on 2011-03-24
5
Medium Priority
?
321 Views
Last Modified: 2013-12-17
How can I read an XML file in C# with this format?

<column name="Year"><![CDATA[2000]]></column>
<column name="Make"><![CDATA[Cadillac]]></column>
<column name="Model"><![CDATA[Deville]]></column>
<column name="Price"><![CDATA[$10,525]]></column>

Open in new window


I want to read the fields instead of parsing the entire XML and process each entry...
0
Comment
Question by:evo_x
[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
  • 2
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 35212912
<column name="Year" data="<![CDATA[2000]]>" />
<column name="Make" data="<![CDATA[Cadillac]]" />
<column name="Model" data="![CDATA[Deville]]" />
<column name="Price" data="<![CDATA[$10,525]]" />

Open in new window


Now you can easily access "data" from the xml.

http://support.microsoft.com/kb/307548
0
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 35212915
Missed some codes.. :)

 
<column name="Year" data="<![CDATA[2000]]>" />
<column name="Make" data="<![CDATA[Cadillac]]>" />
<column name="Model" data="<![CDATA[Deville]]>" />
<column name="Price" data="<![CDATA[$10,525]]>" />

Open in new window

0
 
LVL 2

Author Comment

by:evo_x
ID: 35212925
there is an example of how to read raw xml data, but not the fields with ![CDATA[]...
0
 
LVL 9

Accepted Solution

by:
mayank_joshi earned 2000 total points
ID: 35212932
you can use DataSet.ReadXml Method for that
eg,

String MyXml = "<MyTable><ID>1</ID><ParentID>2</ParentID><Name>Test</Name></MyTable>";

StringReader SR = new StringReader(MyXml);

DataSet ds = new DataSet();
ds.ReadXml(SR);

Open in new window

0
 
LVL 2

Author Comment

by:evo_x
ID: 35212958
I think this is what I need.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 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