Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


XML in dataset

Posted on 2011-10-07
Medium Priority
Last Modified: 2012-05-12
  I have a xml file. I have read the xml and stored into dataset.
When I loop through all tables in dataset and get all columns in a table, I am getting strange column (Booking_Id) with some value.

Booking_Id --> Booking is the node name.

There might be many Booking nodes under <Bookings>  parent node
How is that Booking_Id is generated? On what basis a value is assigned to that Booking_Id?

Question by:rajvja
LVL 14

Accepted Solution

binaryevo earned 750 total points
ID: 36933413
If i remember correctly for the dataset to read the xml right it should be formatted like so:

<?xml version="1.0" encoding="utf-8" ?>

Open in new window

Another option you could do thats a little slicker is utilize linq with the example below:

public IEnumerable<XMLModel> TestXMLS()
            string filePath = HttpContext.Current.Server.MapPath(SettingsModel.XMLFileLocation + "TestXMLFile.xml");
            if (File.Exists(filePath))
                var xml = (from x in XElement.Load(filePath).Elements("TestXMLElement") 
                           select new XMLModel
                               ID = x.Element("ID").Value,
                               Value = x.Element("Value").Value
                return xml;
                throw new Exception("File Path is invalid or file doesnt exist.");

Open in new window

LVL 11

Author Closing Comment

ID: 36941353

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

580 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