コード例 #1
0
ファイル: Commentator.java プロジェクト: psibre/SEMAINE-3.1
 private void say(String text) throws JMSException {
   Document bml = XMLTool.newDocument(BML.ROOT_TAGNAME, BML.namespaceURI);
   Element speech = XMLTool.appendChildElement(bml.getDocumentElement(), BML.E_SPEECH);
   speech.setAttribute("language", "en-US");
   speech.setTextContent(text);
   Element mark = XMLTool.appendChildElement(speech, SSML.E_MARK, SSML.namespaceURI);
   mark.setAttribute(SSML.A_NAME, "m1");
   bmlSender.sendXML(bml, meta.getTime());
 }
コード例 #2
0
ファイル: DummyFML2BML.java プロジェクト: psibre/SEMAINE-3.1
 @Override
 public void react(SEMAINEMessage m) throws JMSException {
   if (!(m instanceof SEMAINEXMLMessage)) {
     throw new MessageFormatException("expected XML message, got " + m.getClass().getSimpleName());
   }
   SEMAINEXMLMessage xm = (SEMAINEXMLMessage) m;
   boolean isFML = "FML".equals(xm.getDatatype());
   if (isFML) {
     // extract the BML and send that along
     Element bml =
         XMLTool.needChildElementByLocalNameNS(
             xm.getDocument().getDocumentElement(), BML.E_BML, BML.namespaceURI);
     Document doc = XMLTool.newDocument(BML.E_BML, BML.namespaceURI);
     doc.adoptNode(bml);
     doc.replaceChild(bml, doc.getDocumentElement());
     bmlSender.sendXML(doc, xm.getUsertime(), xm.getEventType());
   } else { // BML -- send as is
     bmlSender.sendXML(xm.getDocument(), xm.getUsertime(), xm.getEventType());
   }
 }