private static void IgnoreAttributeExcept(XmlElement row, params string[] attrNames)
{
// Only interested in the element that is called z:row.
if (row.LocalName != "row")
{
return;
}
int i = 0;
while (i < row.Attributes.Count)
{
bool isFind = false;
XmlAttribute attr = row.Attributes[i];
foreach (string fieldName in attrNames)
{
if (attr.LocalName == string.Format("{0}{1}", AdapterHelper.PrefixOws, fieldName))
{
i++;
isFind = true;
break;
}
}
if (!isFind)
{
row.Attributes.Remove(attr);
}
}
}