473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading xml attibute using dataset

sam

i am trying to read the following xml in asp.net using C#.I want a mechanism to read the value of id (xxx) and also the value itself (sam
<?xml version="1.0" standalone="yes"?><root><buglist><Bugid>1</Bugid><version>5.0</version><description id ="xxx">sam</description><reported_by>Dallas</reported_by></buglist></root

DataSet d = new DataSet()
FileStream myFs = new FileStream("E:\\webapps\\dbbuglist\\test1.xml",Fil eMode.Open,FileAccess.Read)
d.ReadXml(myFs)

foreach(DataRow myRow in d.Tables["buglist"].Rows
Label1.Text= Int32.Parse((myRow["Bugid"].ToString()));
Label2.Text= Int32.Parse((myRow["version"].ToString()));

Label3.Text= read description ??
Label4.Text= read id ???

Label5.Text= Int32.Parse((myRow["reported_by"].ToString()));

I get an error when i read the descrption node. can you help me get this up on running.


Nov 15 '05 #1
2 1284
VB
Label3.Text= (d.Tables["description"].Rows[0]["id"].ToString())
Label4.Text= (d.Tables["description"].Rows[0]["description_Text"].ToString())

Note, Elements with attributes inferred as Tables

Read this MSDN doc for more detail

http://msdn.microsoft.com/library/de...ringcolumns.as

Nov 15 '05 #2
sam
thank you that worked
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Simon | last post by:
Hi all, I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset. The data set can contain 10's of tables, each with 100's of rows, and I have...
3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
4
by: Phoebe. | last post by:
Hi, Good Day! Reading 1 excel file into a dataset is fine. How can I read multiple excel with the same data structure into 1 dataset? How can I append those data? Can someone help? Thanks in...
1
by: hzgt9b | last post by:
(FYI, using VB .NET 2003) Can someone help me with this... I'm trying to read in an XML file... it appears to work in that the DataSet ReadXML method dose not fail and then I am able to access the...
4
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
0
by: David | last post by:
Hi, using C# 1.1 I am writing a winform app that collects a dataset from a webservice. At the same time I collect the data, I write the dataset out to the local disk using DataSet.WriteXml,...
8
by: T Driver | last post by:
Anyone have any idea how I can do the following? I have a connection to an XML file on a site I do not control, getting a string representation of the xml data that I can then feed to my...
2
by: pkenderdine | last post by:
Can someone please advise the best approach for reading in many 5000+ xml files from disk into a data set. Here is the code so far. On my computer (may not be best spec) is takes about 3 minutes to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.