Hello all,

Do anyone have any idea of what this Exception in occuring when i try to remove the elements in XML using XmlNodeList.

It occurs in following section :

XmlNodeList nodeLst = xmlDoc.GetElementsByTagName("FileName");

foreach (XmlNode node [B]in[/B] nodeLst)
{
//code
}

Pl help ???

Recommended Answers

All 3 Replies

Stop the loop - break;

if (node.InnerText == "...")
                {
                    node.ParentNode.RemoveAll();
                    break;
                }

i want to do designing in my visual basic.......i m using c#......plz tell me the different ways......

Thank you so much . It works

Can you tell me how to remove that parent node also so that i can add new node to my xml.

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.