Using Emacs Major Mode to Edit VoiceXML documents

Emacs is a self-documenting, customizable, extensible real-time display editor that is used in UNIX. More information about Emacs and customization can be found here. This document describes how to customize Emacs with a major mode for VoiceXML. It also provides limited VoiceXML validation capabilities.

To extend Emacs to support VoiceXML editing, you'll need the following:

  1. UNIX operating system (root access required)
  2. Emacs
  3. PSGML 1.2+
  4. NSGMLS
  5. VoiceXML 2.0 DTD.
  6. dictionary-mode.el file
  7. Catalog file
  8. xml.dcl file
  9. .emacs addition

Follow these steps to install major mode for VoiceXML:

  1. Download, make and install the latest (v1.2+) version of psgml from: http://www.lysator.liu.se/projects/about_psgml.html. You can find Installation instructions here: http://www.lysator.liu.se/~lenst/about_psgml/psgml.html#SEC2
  2. Insert the contents of the .emacs file addition at the end of your .emacs file. If the .emacs file does not exist in your home directory, you will have to create one.
  3. Copy the following files to the directory /usr/local/lib/sgml:

Follow these steps to verify that installation of VoiceXML major mode was successful:

  • Launch Emacs editor, and load a VoiceXML document.
  • If the major mode has been installed correctly, VoiceXML elements in the document will be syntax-colored. In addition, several mode-specific commands will be available. For example, type "C-c /" to terminate the current tag. Type "Ctrl-right click" to view a context menu with commands relevant to the current cursor location.
  • Load a VoiceXML document containing JavaScript. The JavaScript will not be syntax-colored by default. To syntax-color the JavaScript code, type "C-c j". You will see only the JavaScript code in the buffer, and it will be highlighted with the Java rules. When you are done editing the JavaScript code, type "C-c r".

To add validation support using nsgml, follow these steps:

  1. Download the SP source code from: http://www.jclark.com/sp/howtoget.htm
  2. Edit the Makefile:
    • Add -DSP_HAVE_SOCKET, under XDEFINES (see http://www.jclark.com/sp/build.htm).
    • Edit the value of the prefix variable. The prefix variables defines where NSGMLS will be installed. The default is
      prefix=/opt/local
      .
  3. Run "make". If make is successful, run "make install".

Test nsgml by executing the following command, replacing "example.vxml" with the path to a VoiceXML document.

nsgmls -wxml -s example.vxml

Alternatively, you can run nsgml from within Emacs by typing "C-c C-v".

If you put the public DOCTYPE identifier in a VoiceXML document, nsgml must be able to fetch it. nsgml does not support authentication, so the DTD must not be hosted in a password protected location.

<!DOCTYPE vxml 
  PUBLIC "-//Tellme Networks// DTD VXML//EN" 
  "http://studio.tellme.com/vxml2/dtd/vxml-20-tm-pub.dtd">

If you have a local copy of the VoiceXML 2.0 DTD, you can specify it using the following DOCTYPE identifier:

<!DOCTYPE vxml 
  PUBLIC "-//Tellme Networks// DTD VXML//EN" 
  "/usr/local/lib/sgml/vxml-20-tm-pub.dtd">

Update the local path to the DTD accordingly.

The validator prints an error message if there is no DOCTYPE declaration in a document, but it recovers by looking it up in the CATALOG.

There are some issues related to how nsgmls and psgml searches for the DTD when it is specified both by a PUBLIC identifier and a SYSTEM identifier as in the above example. psgml requires a SYSTEM identifier; nsgmls does not.

[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers