drools-eclipse/org.guvnor.eclipse.webdav/src/interface/org/eclipse/webdav/dom/ResponseBody.java
public PropStat accumulatePropStat(Element element, String status, String responseDescription) throws MalformedElementException {

        Assert.isNotNull(element);
        Assert.isNotNull(status);

        Element child = getFirstChild(root, new String[] {"href", "status"}); //$NON-NLS-1$ //$NON-NLS-2$
        Assert.isTrue(child == null || isDAVElement(child, "href") //$NON-NLS-1$
                && getNextSibling(child, new String[] {"href", "status"}) == null); //$NON-NLS-1$ //$NON-NLS-2$

        boolean found = false;
        Element propstat = getFirstChild(root, "propstat"); //$NON-NLS-1$

        while (!found && propstat != null) {
            String text = getChildText(propstat, "status", false); //$NON-NLS-1$
            if (text != null && text.equals(status))
                found = true;
            else
                propstat = getTwin(propstat, true);

        }

        Element prop = null;

        if (propstat == null) {
            propstat = addChild(root, "propstat", fgNamesPropStat, false); //$NON-NLS-1$
            prop = setChild(propstat, "prop", PropStat.childNames, true); //$NON-NLS-1$
            setChild(propstat, "status", status, PropStat.childNames, false); //$NON-NLS-1$
        } else {
            prop = getFirstChild(propstat, "prop"); //$NON-NLS-1$
            if (prop == null)
                prop = setChild(propstat, "prop", PropStat.childNames, true); //$NON-NLS-1$
        }

        if (responseDescription == null) {
            Element responsedescription = getLastChild(propstat, "responsedescription"); //$NON-NLS-1$
            if (responsedescription != null)
                propstat.removeChild(responsedescription);
        } else
            setChild(propstat, "responsedescription", //$NON-NLS-1$
                    responseDescription, PropStat.childNames, false);

        extractNode(prop, element);

        try {
            return new PropStat(propstat);
        } catch (MalformedElementException e) {
            Assert.isTrue(false, Policy.bind("assert.internalError")); //$NON-NLS-1$
            return null; // Never reached.
        }
    }
public PropStat accumulatePropStat(Element element, String status, String responseDescription) throws MalformedElementException {

        Assert.isNotNull(element);
        Assert.isNotNull(status);

        Element child = getFirstChild(root, new String[] {"href", "status"}); //$NON-NLS-1$ //$NON-NLS-2$
        Assert.isTrue(child == null || isDAVElement(child, "href") //$NON-NLS-1$
                && getNextSibling(child, new String[] {"href", "status"}) == null); //$NON-NLS-1$ //$NON-NLS-2$

        boolean found = false;
        Element propstat = getFirstChild(root, "propstat"); //$NON-NLS-1$

        while (!found && propstat != null) {
            String text = getChildText(propstat, "status", false); //$NON-NLS-1$
            if (text != null && text.equals(status))
                found = true;
            else
                propstat = getTwin(propstat, true);

        }

        Element prop = null;

        if (propstat == null) {
            propstat = addChild(root, "propstat", fgNamesPropStat, false); //$NON-NLS-1$
            prop = setChild(propstat, "prop", PropStat.childNames, true); //$NON-NLS-1$
            setChild(propstat, "status", status, PropStat.childNames, false); //$NON-NLS-1$
        } else {
            prop = getFirstChild(propstat, "prop"); //$NON-NLS-1$
            if (prop == null)
                prop = setChild(propstat, "prop", PropStat.childNames, true); //$NON-NLS-1$
        }

        if (responseDescription == null) {
            Element responsedescription = getLastChild(propstat, "responsedescription"); //$NON-NLS-1$
            if (responsedescription != null)
                propstat.removeChild(responsedescription);
        } else
            setChild(propstat, "responsedescription", //$NON-NLS-1$
                    responseDescription, PropStat.childNames, false);

        extractNode(prop, element);

        try {
            return new PropStat(propstat);
        } catch (MalformedElementException e) {
            Assert.isTrue(false, Policy.bind("assert.internalError")); //$NON-NLS-1$
            return null; // Never reached.
        }
    }
public PropStat accumulatePropStat ( Element element , String status , String responseDescription ) throws MalformedElementException { Assert . isNotNull ( element ) ; Assert . isNotNull ( status ) ; Element child = getFirstChild ( root , new String [ ] { "href" , "status" } ) ; //$NON-NLS-1$ //$NON-NLS-2$ Assert . isTrue ( child == null || isDAVElement ( child , "href" ) //$NON-NLS-1$ && getNextSibling ( child , new String [ ] { "href" , "status" } ) == null ) ; //$NON-NLS-1$ //$NON-NLS-2$ boolean found = false ; Element propstat = getFirstChild ( root , "propstat" ) ; //$NON-NLS-1$ while ( ! found && propstat != null ) { String text = getChildText ( propstat , "status" , false ) ; //$NON-NLS-1$ if ( text != null && text . equals ( status ) ) found = true ; else propstat = getTwin ( propstat , true ) ; } Element prop = null ; if ( propstat == null ) { propstat = addChild ( root , "propstat" , fgNamesPropStat , false ) ; //$NON-NLS-1$ prop = setChild ( propstat , "prop" , PropStat . childNames , true ) ; //$NON-NLS-1$ setChild ( propstat , "status" , status , PropStat . childNames , false ) ; //$NON-NLS-1$ } else { prop = getFirstChild ( propstat , "prop" ) ; //$NON-NLS-1$ if ( prop == null ) prop = setChild ( propstat , "prop" , PropStat . childNames , true ) ; //$NON-NLS-1$ } if ( responseDescription == null ) { Element responsedescription = getLastChild ( propstat , "responsedescription" ) ; //$NON-NLS-1$ if ( responsedescription != null ) propstat . removeChild ( responsedescription ) ; } else setChild ( propstat , "responsedescription" , //$NON-NLS-1$ responseDescription , PropStat . childNames , false ) ; extractNode ( prop , element ) ; try { return new PropStat ( propstat ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; //$NON-NLS-1$ return null ; // Never reached. } }
Gets this response's first propstat with the given status and adds a
clone of the given element as a property of its prop. If such a
propstat does not exists, it is created. The propstat's response
description is set to the given response description, or removed if
the response description is <code>null</code>. Returns the propstat.
The element and status must not be <code>null</code>. This response
must not already be in the "status" form.

@param element             the property element being added
@param status              the status of the propstat to add the
property element to
@param responseDescription the new response description of the
propstat, or <code>null</code> to remove
the old one
@return                    a propstat with the given property
element, status, and response description
@throws                    MalformedElementException if there is
reason to believe that the given element
is not well formed
Gets this response s first propstat with the given status and adds a clone of the given element as a property of its prop . If such a propstat does not exists it is created . The propstat s response description is set to the given response description or removed if the response description is <code > null< / code > . Returns the propstat . The element and status must not be <code > null< / code > . This response must not already be in the status form .