How to compare two xml nodes?

My XML node has 6 attributes, but the fact is that from these attributes I need to check that the weather attributes 2 are equal or not. If equal, then the record must be skipped; otherwise it must be written in the XML file

I'm trying to execute 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;
}

Does not work!

+2
source share
1 answer

As far as I know, you cannot change web.configat runtime, because after changing it, your application restarts.

Also, I'm not sure, but I think comparing XmlNode and XmlElement with simple == will not work, as it only compares links, not objects

+2
source

All Articles