cursor.pop();
if (!cursor.toNextSibling(J2EE_NAMESPACE, "activation-config")) { boolean hasProperties = false;  cursor.toNextSibling();  moveable.toCursor(cursor); cursor.push(); cursor.beginElement("activation-config", J2EE_NAMESPACE); hasProperties |= addActivationConfigProperty(moveable, cursor, "message-selector", "messageSelector"); hasProperties |= addActivationConfigProperty(moveable, cursor, "acknowledge-mode", "acknowledgeMode"); if (moveable.toNextSibling(J2EE_NAMESPACE, "message-driven-destination")) { moveable.push(); moveable.toFirstChild(); hasProperties |= addActivationConfigProperty(moveable, cursor, "destination-type", "destinationType"); hasProperties |= addActivationConfigProperty(moveable, cursor, "subscription-durability", "subscriptionDurability"); moveable.pop(); moveable.removeXml(); } cursor.pop(); if (!hasProperties) { cursor.toPrevSibling(); cursor.removeXml(); } }
    public static void convertBeans(XmlCursor cursor, XmlCursor moveable) {        cursor.toChild(J2EE_NAMESPACE, "ejb-jar");        cursor.toChild(J2EE_NAMESPACE, "enterprise-beans");        if (cursor.toFirstChild()) {            //there's at least one ejb...            do {                cursor.push();                String type = cursor.getName().getLocalPart();                if ("session".equals(type)) {                    cursor.toChild(J2EE_NAMESPACE, "transaction-type");                    cursor.toNextSibling();                    convertToJNDIEnvironmentRefsGroup(cursor, moveable);                } else if ("entity".equals(type)) {                    //reentrant is the last required tag before jndiEnvironmentRefsGroup                    cursor.toChild(J2EE_NAMESPACE, "reentrant");                    cursor.toNextSibling(J2EE_NAMESPACE, "cmp-version");                    cursor.toNextSibling(J2EE_NAMESPACE, "abstract-schema-name");                    while (cursor.toNextSibling(J2EE_NAMESPACE, "cmp-field")) ;                    cursor.toNextSibling(J2EE_NAMESPACE, "primkey-field");                    cursor.toNextSibling();                    convertToJNDIEnvironmentRefsGroup(cursor, moveable);                } else if ("message-driven".equals(type)) {                    cursor.toChild(J2EE_NAMESPACE, "transaction-type");                    //add messaging-type                    cursor.insertElementWithText("messaging-type", J2EE_NAMESPACE, "javax.jms.MessageListener");                    //skip transaction-type                    cursor.toNextSibling();                    //add activation-config-properties.                    moveable.toCursor(cursor);                    cursor.push();                    cursor.beginElement("activation-config", J2EE_NAMESPACE);                    addActivationConfigProperty(moveable, cursor, "message-selector", "messageSelector");                    addActivationConfigProperty(moveable, cursor, "acknowledge-mode", "acknowledgeMode");                    if (moveable.toNextSibling(J2EE_NAMESPACE, "message-driven-destination")) {                        moveable.push();                        moveable.toFirstChild();                        addActivationConfigProperty(moveable, cursor, "destination-type", "destinationType");                        addActivationConfigProperty(moveable, cursor, "subscription-durability", "subscriptionDurability");                        moveable.pop();                        moveable.removeXml();                    }                    cursor.pop();                    cursor.toNextSibling();                    convertToJNDIEnvironmentRefsGroup(cursor, moveable);                }                cursor.pop();            } while (cursor.toNextSibling());        }    }