Solved

XML reading in C#

Posted on 2011-03-24
5
316 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
  • 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 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

765 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