class XmlExtensionNotificationDataConverter implements ExtensionNotificationDataConverter {

    @Override
    public Object convertSynthesizedOutputEvent(SynthesizedOutputEvent output)
            throws ConversionException {

        final DocumentBuilderFactory factory = DocumentBuilderFactory
                .newInstance();
        factory.setNamespaceAware(true);
        try {
            final DocumentBuilder builder = factory.newDocumentBuilder();
            final Document document = builder.newDocument();
            final Element data = document.createElementNS(JVXML_MMI_NAMESPACE,
                    "jvxmlmmi:data");
            document.appendChild(data);
            final SpeakableText speakable = getSpeakable(output);
            if (speakable != null) {
                final Document ssml = toDocument(speakable);
                final Node speak = ssml.getFirstChild();
                if (speak != null) {
                    document.adoptNode(speak);
                    data.appendChild(speak);
                }
            }
            return data;
        } catch (ParserConfigurationException e) {
            throw new ConversionException(e.getMessage(), e);
        } catch (SAXException e) {
            throw new ConversionException(e.getMessage(), e);
        } catch (IOException e) {
            throw new ConversionException(e.getMessage(), e);
        }
    }

}