?
Solved

Read XML

Posted on 2012-09-17
2
Medium Priority
?
290 Views
Last Modified: 2012-10-10
Hi,

I have to write a c# winforms application which should be able to read any xml file. Here i am trying to give a xml file in which tags are not that consistent. like there is one <InvoiceNo> tag under which there is <tax>, <discount> <tender> ....

There are few invoice number where there is no discount and tax nodes. How can i read that and put that into a data table. its bit urgent.

Regards
Rajeeva
0
Comment
Question by:rajeeva_nagaraj
2 Comments
 
LVL 23

Assisted Solution

by:apresto
apresto earned 500 total points
ID: 38405323
Is the structure consistent for the xml?

If it is then why dont you create a series of objects that mirror the structure of the xml and populate it from there.

You can use this to help you read the xml, understanding this should make actually populating it alot easier.

http://www.dreamincode.net/forums/topic/48954-working-with-xml-files-in-c%23/
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 38408411
you can load the entire XML into a XmlDocument and traverse it node by node. This is a valid solution if the XML is not too big.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

839 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