class VoiceXmlInterpreter {

    void setDocument(final VoiceXmlDocument doc, final String startDialog,
            final Configuration configuration) throws ConfigurationException {
        if (doc == null) {
            document = null;
            return;
        }
        document = doc;

        final Vxml vxml = document.getVxml();
        if (vxml == null) {
            LOGGER.warn("no vxml tag found in '" + doc + "'");
            return;
        }

        // Determine all dialogs of the current document.
        final DialogFactory factory = configuration
                .loadObject(DialogFactory.class);
        dialogs = factory.getDialogs(vxml);

        if (startDialog == null) {
            // Check if there is at least one dialog and take this one as the
            // next dialog.
            final Iterator<Dialog> iterator = dialogs.iterator();
            if (iterator.hasNext()) {
                nextDialog = iterator.next();
            }
        } else {
            nextDialog = getDialog(startDialog);
        }
        if (nextDialog == null) {
            if (startDialog == null) {
                LOGGER.info("the document does not contain any dialogs");
            } else {
                LOGGER.warn("start dialog '" + startDialog
                        + "' not found in document!");
            }
        } else {
            LOGGER.info("interpreter starts with dialog '" + nextDialog.getId()
                    + "'");
        }
    }

    public  VoiceXmlInterpreter(final VoiceXmlInterpreterContext ctx);

}