private bool MoveToNextNamespace(XmlBoundElement be, DataColumn col, XmlAttribute curAttr)
{
if (be != null)
{
if (be.IsFoliated)
{
XmlAttributeCollection attrs = be.Attributes;
XmlAttribute attr = null;
bool bFound = false;
if (curAttr == null)
bFound = true; //the first namespace will be the one
#if DEBUG
if (curAttr != null)
Debug.Assert(curAttr.NamespaceURI == StrReservedXmlns);
#endif
Debug.Assert(attrs != null);
int attrInd = attrs.Count;
while (attrInd > 0)
{
attrInd--;
attr = attrs[attrInd];
if (bFound && attr.NamespaceURI == StrReservedXmlns && !DuplicateNS(be, attr.LocalName))
{
MoveTo(attr);
return true;
}
if (attr == curAttr)
bFound = true;
}
}
else
{//defoliated so that we need to search through its column
DataRow curRow = be.Row;
if (curRow == null)
return false;
//going through its attribute columns
DataColumn curCol = PreviousColumn(curRow, col, true);
while (curCol != null)
{
if (curCol.Namespace == StrReservedXmlns && !DuplicateNS(be, curCol.ColumnName))
{
MoveTo(be, curCol, false);
return true;
}
curCol = PreviousColumn(curRow, curCol, true);
}
}
}
return false;
}