drools-eclipse/org.guvnor.eclipse.webdav/src/interface/org/eclipse/webdav/dom/ElementEditor.java
public static Element setChild(Element parent, String name, String[] names, boolean firstToLast) {
        Assert.isTrue(isDAVElement(parent));
        Assert.isNotNull(name);
        Assert.isNotNull(names);
        String nsPrefix = getNSPrefix(parent);
        String tagName = nsPrefix == null ? name : nsPrefix + ":" + name; //$NON-NLS-1$
        Element child = parent.getOwnerDocument().createElement(tagName);
        setChild(parent, child, names, firstToLast);
        return child;
    }
public static Element setChild(Element parent, String name, String[] names, boolean firstToLast) {
        Assert.isTrue(isDAVElement(parent));
        Assert.isNotNull(name);
        Assert.isNotNull(names);
        String nsPrefix = getNSPrefix(parent);
        String tagName = nsPrefix == null ? name : nsPrefix + ":" + name; //$NON-NLS-1$
        Element child = parent.getOwnerDocument().createElement(tagName);
        setChild(parent, child, names, firstToLast);
        return child;
    }
public static Element setChild ( Element parent , String name , String [ ] names , boolean firstToLast ) { Assert . isTrue ( isDAVElement ( parent ) ) ; Assert . isNotNull ( name ) ; Assert . isNotNull ( names ) ; String nsPrefix = getNSPrefix ( parent ) ; String tagName = nsPrefix == null ? name : nsPrefix + ":" + name ; //$NON-NLS-1$ Element child = parent . getOwnerDocument ( ) . createElement ( tagName ) ; setChild ( parent , child , names , firstToLast ) ; return child ; }
<p>Creates a WebDAV element with the given name and sets it as a
child of the given parent. Returns the child element.
<p>Children are positioned in the order specified by the given names.
If a child with the same name as the child already exist, the child
is replaced. If firstToLast is true, the search for the child's
position starts at the parent's first child, otherwise, the search
starts at the parent's last child.
<p>The parent must not be <code>null</code> and must be a WebDAV
element.  The child's name must not be <code>null</code>.  The
parent's valid child names must not be <code>null</code>, and must
contain the name of the child.

@param parent      the parent to which the child is added
@param name        the name of the child which is created and added
to the parent
@param names       the ordered collection of valid child names for
the parent
@param firstToLast a boolean specifying the direction to search for
the child's position among the parent's children
@return            the child element that is created
<p > Creates a WebDAV element with the given name and sets it as a child of the given parent . Returns the child element . <p > Children are positioned in the order specified by the given names . If a child with the same name as the child already exist the child is replaced . If firstToLast is true the search for the child s position starts at the parent s first child otherwise the search starts at the parent s last child . <p > The parent must not be <code > null< / code > and must be a WebDAV element . The child s name must not be <code > null< / code > . The parent s valid child names must not be <code > null< / code > and must contain the name of the child .