sadhawan 0 Light Poster

Hi Guys,i have the following code and i am trying to collect all the attributes with a tag name "file" .Wheni run the lopp the value of collection keep changing instead of collecting it like an array.Can anyone help me with this.
Thanks

private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();
            op.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
            if (op.ShowDialog() == DialogResult.OK)
            {
                string xmlFilename = op.FileName;
                //XmlTextReader reader = new XmlTextReader(xmlFilename);
                XmlDocument xDoc = new XmlDocument();
                xDoc.Load(xmlFilename);
                XmlNodeList title = xDoc.GetElementsByTagName("title");
                MessageBox.Show("Title" + title[0].InnerText);
                XmlNodeList item = xDoc.GetElementsByTagName("item");
                for (int i = 0; i < item.Count; i++)
                {
                    //MessageBox.Show("Item" + item[i].InnerText);

                }
                XmlNodeList fl = xDoc.GetElementsByTagName("file");
                
               
                foreach (XmlNode attr in fl)
                {
                    XmlAttributeCollection att = attr.Attributes;
                    
                }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.