Read XML

Posted on 2012-09-17
Last Modified: 2012-10-10

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.

Question by:rajeeva_nagaraj
    LVL 23

    Assisted Solution

    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.
    LVL 55

    Accepted Solution

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Normally a window is moved by clicking on the caption bar and dragging. You may want your user to be able to move borderless forms or move a form by clicking anywhere in the form without the limitation to the caption bar. There are many ways to do i…
    The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now