Exemplo n.º 1
0
        ///
        ///	 <summary> * searches for the first element occurence in the ancestor elements
        ///	 *  </summary>
        ///	 * <param name="element"> the element name </param>
        ///	 * <param name="nameSpaceURI"> the XML-namespace of the element </param>
        ///	 * <param name="xPath"> the xpath of a required attribute
        ///	 * @since 290502 </param>
        ///	 * <returns> value of attribute found, empty string if not available </returns>
        ///
        public virtual KElement getAncestorElement(string element, string nameSpaceURI, string xPath)
        {
            VElement v         = getPoolChildren(null);
            bool     bWildCard = isWildCard(xPath);

            // the last in list is the direct parent, the first is the original root
            for (int i = v.Count - 1; i >= 0; i--)
            {
                JDFAncestor ancestor = (JDFAncestor)v[i];
                KElement    e        = ancestor.getElement(element, nameSpaceURI, 0);
                if ((e != null) && (bWildCard || e.hasXPathNode(xPath)))
                {
                    return(e);
                }
            }
            // not found, return an empty element
            return(null);
        }