public override bool MoveToNextAttribute ()
{
if (current == null)
return false;
XmlNode anode = current;
if (current.NodeType != XmlNodeType.Attribute) {
// then it's either an attribute child or anything on the tree.
if (current.ParentNode == null || // document, or non-tree node
current.ParentNode.NodeType != XmlNodeType.Attribute) // not an attr value
return MoveToFirstAttribute ();
anode = current.ParentNode;
}
{
XmlAttributeCollection ac = ((XmlAttribute) anode).OwnerElement.Attributes;
for (int i=0; i<ac.Count-1; i++)
{
XmlAttribute attr = ac [i];
if (attr == anode)
{
i++;
if (i == ac.Count)
return false;
current = ac [i];
return true;
}
}
return false;
}
}