while ((tmpAttr == null) && (tmpNode != null))
{
while ((tmpNode != null) && (tmpNode.LocalName != "entry"))
tmpNode = slGuestbook.NextNode(tmpNode);
try
{
tmpAttr = (XmlAttribute)tmpNode.Attributes.GetNamedItem(attrName);
if (tmpAttr.Value == attrValue)
{
return tmpNode;
}
else
{
tmpAttr = null;
tmpNode = slGuestbook.NextNode(tmpNode);
}
}
catch
{
tmpAttr = null;
}
}
return tmpNode;
}
#region Method NextNode()
/// <summary>
/// Method to jump to next node. It´s irrelevant if next node is a child or parent node.
/// </summary>
/// <param name="actNode">Actual Node.</param>
/// <returns>Next Node if exists, else null (end of XML!).</returns>
public static XmlNode NextNode(XmlNode actNode)
{
if (actNode.HasChildNodes)
{
return actNode.FirstChild;
}
try
{
if (actNode.NextSibling != null)
{
actNode = actNode.NextSibling;
}
else
{
actNode = actNode.ParentNode;
while (actNode.NextSibling == null)
actNode = actNode.ParentNode;
actNode = actNode.NextSibling;
}
}
catch
{
actNode = null;
}
return actNode;
}
#endregion