Chintan
Chintan

Reputation: 2808

How to compare two xml nodes?

My XML node have 6 attributes but the thing is from these attributes I need to check weather 2 attributes are equal or not. If equal then the the entry should be omitted otherwise must be written in XML file

I am trying code

private static bool checkDuplication(XmlElement Xtemp, XmlNodeList xmlNodeList)
{
    foreach (XmlNode node in xmlNodeList)
    {
        for (int i = 0; i < ComparableAttributes.Count(); i++)
        {
            if (node == Xtemp)
            {
                return true;
            }
        }
     }
     return false;
}

Its not working!

Upvotes: 2

Views: 1228

Answers (1)

Alex Dn
Alex Dn

Reputation: 5553

As far as I know, you cannot modify web.config at runtime, since when it is changed, your Application restarts.

In addition, I'm not sure, but I think think comparing XmlNode and XmlElement with simple == will not work since it compares references only and not objects content

Upvotes: 2

Related Questions