public TreeNode GetLastDescendantWithXmlElement(string localName) { if (mChildren.Count == 0) { return(null); } for (int i = Children.Count - 1; i >= 0; i--) { TreeNode child = Children.Get(i); if (child.HasXmlProperty && child.GetXmlElementLocalName() == localName) { return(child); } TreeNode childIn = child.GetLastDescendantWithXmlElement(localName); if (childIn != null) { return(childIn); } } return(null); }
public TreeNode GetPreviousSiblingWithXmlElement(string localName) { if (Parent == null) { return(null); } TreeNode previous = this; while ((previous = previous.PreviousSibling) != null) { if (previous.HasXmlProperty && previous.GetXmlElementLocalName() == localName) { return(previous); } TreeNode previousIn = previous.GetLastDescendantWithXmlElement(localName); if (previousIn != null) { return(previousIn); } } return(Parent.GetPreviousSiblingWithXmlElement(localName)); }