public static DataForm getPublishOptions( IQ iq )
    {
        final Element publishOptionsElement = iq.getChildElement().element( "publish-options" );
        if ( publishOptionsElement == null )
        {
            return null;
        }

        final Element x = publishOptionsElement.element( QName.get( DataForm.ELEMENT_NAME, DataForm.NAMESPACE ) );
        if ( x == null )
        {
            return null;
        }

        final DataForm result = new DataForm( x );
        if ( result.getType() != DataForm.Type.submit )
        {
            return null;
        }

        final FormField formType = result.getField( "FORM_TYPE" );
        if ( formType == null || !"http://jabber.org/protocol/pubsub#publish-options".equals( formType.getFirstValue() ) )
        {
            return null;
        }

        return result;
    }
Get the dataform that describes the publish options from the request, or null if no such form was included.

@param iq The publish request (cannot be null).
@return A publish options data form (possibly null).
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/PubSubEngine.java