private static Element getChild(Element parent, String[] names, boolean firstToLast) {
    """
	Returns the first child of the given parent that is a WebDAV element
	with one of the given names, or <code>null</code> if no such child
	exists.
	<p>
	If firstToLast is true, the search for the child starts at the parent's
	first child, otherwise, the search starts at the parent's last child.
	The parent must not be <code>null</code> and must be a WebDAV element.
	The names of children to search for must not be <code>null</code>.</p>
	
	@param parent      the parent of the child to search.
	@param names       all possible names of the child to search for.
	@param firstToLast a boolean specifying the direction to search for
	the child among the parent's children.
	@return            the specified child of the parent, or
	<code>null<code> if no such child exists.
    """

        Assert.isTrue(isDAVElement(parent));
        Assert.isNotNull(names);

        // Get the first candidate.
        Node child = null;
        if (firstToLast)
            child = parent.getFirstChild();
        else
            child = parent.getLastChild();

        // While there are children left to consider.
        while (child != null) {

            // See if the child name matches any being sought.
            for (int i = 0; i < names.length; ++i)
                if (isDAVElement(child, names[i]))
                    return (Element) child;

            // Try the next child.
            if (firstToLast)
                child = child.getNextSibling();
            else
                child = child.getPreviousSibling();
        }

        // A matching child was not found.
        return null;
    }
private static Element getChild(Element parent, String[] names, boolean firstToLast) {

        Assert.isTrue(isDAVElement(parent));
        Assert.isNotNull(names);

        // Get the first candidate.
        Node child = null;
        if (firstToLast)
            child = parent.getFirstChild();
        else
            child = parent.getLastChild();

        // While there are children left to consider.
        while (child != null) {

            // See if the child name matches any being sought.
            for (int i = 0; i < names.length; ++i)
                if (isDAVElement(child, names[i]))
                    return (Element) child;

            // Try the next child.
            if (firstToLast)
                child = child.getNextSibling();
            else
                child = child.getPreviousSibling();
        }

        // A matching child was not found.
        return null;
    }
private static Element getChild ( Element parent , String [ ] names , boolean firstToLast ) { Assert . isTrue ( isDAVElement ( parent ) ) ; Assert . isNotNull ( names ) ; // Get the first candidate. Node child = null ; if ( firstToLast ) child = parent . getFirstChild ( ) ; else child = parent . getLastChild ( ) ; // While there are children left to consider. while ( child != null ) { // See if the child name matches any being sought. for ( int i = 0 ; i < names . length ; ++ i ) if ( isDAVElement ( child , names [ i ] ) ) return ( Element ) child ; // Try the next child. if ( firstToLast ) child = child . getNextSibling ( ) ; else child = child . getPreviousSibling ( ) ; } // A matching child was not found. return null ; }
Returns the first child of the given parent that is a WebDAV element
with one of the given names, or <code>null</code> if no such child
exists.
<p>
If firstToLast is true, the search for the child starts at the parent's
first child, otherwise, the search starts at the parent's last child.
The parent must not be <code>null</code> and must be a WebDAV element.
The names of children to search for must not be <code>null</code>.</p>

@param parent      the parent of the child to search.
@param names       all possible names of the child to search for.
@param firstToLast a boolean specifying the direction to search for
the child among the parent's children.
@return            the specified child of the parent, or
<code>null<code> if no such child exists.
Returns the first child of the given parent that is a WebDAV element with one of the given names or <code > null< / code > if no such child exists . <p > If firstToLast is true the search for the child starts at the parent s first child otherwise the search starts at the parent s last child . The parent must not be <code > null< / code > and must be a WebDAV element . The names of children to search for must not be <code > null< / code > . < / p >