public TreeNode GetLastDescendantWithXmlAttribute(string attrName) { if (mChildren.Count == 0) { return(null); } for (int i = Children.Count - 1; i >= 0; i--) { TreeNode child = Children.Get(i); if (child.HasXmlProperty && child.GetXmlProperty().GetAttribute(attrName) != null) { return(child); } TreeNode childIn = child.GetLastDescendantWithXmlAttribute(attrName); if (childIn != null) { return(childIn); } } return(null); }
public TreeNode GetPreviousSiblingWithXmlAttribute(string attrName) { if (Parent == null) { return(null); } TreeNode previous = this; while ((previous = previous.PreviousSibling) != null) { if (previous.HasXmlProperty && previous.GetXmlProperty().GetAttribute(attrName) != null) { return(previous); } TreeNode previousIn = previous.GetLastDescendantWithXmlAttribute(attrName); if (previousIn != null) { return(previousIn); } } return(Parent.GetPreviousSiblingWithXmlAttribute(attrName)); }