473,503 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Reading attributes value from XML file

6 New Member
<Root>
<Family ID="1">
<Member Name="Abe" DOB="3/31/42" />
<Member Name="Betty" DOB="2/4/49" />
<Member Name="Cathy" DOB="12/2/78" />
<Member Name="Dan" Father="Abe" Mother="Betty" DOB="6/12/73" />
</Family>
<Family ID="2">
<Member Name="Edith" Father="Abe" Mother="Betty" DOB="8/30/80" />
<Member Name="Frank" DOB="11/4/70" />
<Member Name="George" Father="Dan" Mother="Cathy" DOB="5/13/94" />
<Member Name="Harold" Father="Dan" Mother="Cathy" DOB="7/1/97" />
<Member Name="Irwin" Father="Frank" Mother="Edith" DOB="10/31/01" />
<Member Name="Janet" Father="Frank" Mother="Edith" DOB="1/17/03" />
</Family>
</Root>


This is my Xml file.I want to seperate every family tag by using it's ID attribute and also i want to read the attributes from Member elements.i write a code for this But i am getting error.I am using framework 2.0 and c#.In vb.net there is a property named ItemOf,but in c# it's not existing.So any body help me.Thanks in advance


XmlDocument xDoc = new XmlDocument();
xDoc.Load(Family.xml);

int Count1 = Convert.ToInt32(xDoc.SelectNodes("/Root/Family").Count);
for (int bmp = 1; bmp < Count1; bmp++)
{
int Count = Convert.ToInt32(xDoc.SelectNodes("/Root/Family[" + bmp + "]/Member").Count);
for (int bnp = 1; bnp < Count; bnp++)
{
Response.Write("hi"+xDoc.SelectSingleNode("/Catalog/Items[" + bmp + "]/Member[" + bnp + "]").Attributes.Item["Name"].Value);
}
}
Dec 6 '06 #1
0 2280

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5740
by: Lee Mundie | last post by:
Hi there, Simple problem here but can't seem to fix it! Okay, I have a select list from which people choose avatars... the list is option values ie. <option>Worm</option> ...
0
1688
by: WebHouse.Co | last post by:
Hi Sir I'm in my 2nd year in M.Sc. degree & I made a project about the powerful tools SQLXML 3.0 & updategram, so I made a list of programs which r they so similar to the example that using...
6
2467
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
9
1983
by: Xarky | last post by:
Hi, I am writing an XML file in the following way. Now I need to read again that file to retrieve data such as Name and Age. Can someone help me out. Thanks in Advance ...
27
5083
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
5
2683
by: =?Utf-8?B?VGhlIE1hbiBGcm9tIFNRTA==?= | last post by:
I'm having the darndest XML config file problem that I really need help with. I'm supporting a .NET 1.1 desktop application with its own config file, and I implement IConfigurationSectionHandler...
1
1797
by: Pathik | last post by:
Hi All, I have to get the values of "reading" and "value" elements of context Person/Category/Group/ser.These values must be on condition based,means I have to get the values of "reading" and...
1
2277
by: nitusa | last post by:
Hi All, First time poster, and newbie C# programmer so be patient with my ignorance. :) For my current project I need to store some information (install dir., file names, passwords, ect.) and...
1
2749
by: Demon4231 | last post by:
I have a XML file that stores information about an application I am trying to read and it looks like this: <Data> <Login UserName="Username" Password="Password"/> <Application...
0
7202
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
7086
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
7280
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
7332
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
5578
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,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.