469,337 Members | 6,013 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,337 developers. It's quick & easy.

xml... attribute reading

<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 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" />

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
Mar 10 '07 #1
3 4157
117 100+
XmlNodeList xmlnode = xmldoc.GetElementsByTagName("Family");
for(int i=0;i<xmlnode.Count;i++)
XmlAttributeCollection xmlattrc = xmlnode[i].Attributes;
if (xmlattrc[0].Value == 1)
// now here read the "Member Node's attributes"
Mar 11 '07 #2
839 Expert 512MB
ItemOf VB property is designated as the C# indexer.
For example, calling SelectNodes() on an XML element returns a XmlNodeList object. You can index into this collection using square parenthesis.
Mar 12 '07 #3
839 Expert 512MB
Did you succeed to solve the problem ?
If yes, please let me know, in order to close the thread.
Mar 21 '07 #4

Post your reply

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

Similar topics

6 posts views Thread by Coral Snake | last post: by
14 posts views Thread by Del Ferguson | last post: by
5 posts views Thread by Neil Norfolk | last post: by
1 post views Thread by arnold | last post: by
4 posts views Thread by Hemal Pandya | last post: by
6 posts views Thread by Adam Donahue | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.