Accessing the Editors and Templates
Contents
Composer editors are embedded/integrated within the user interface and are made available to you whenever a .scxml, .vxml, .ccxml, .grxml, or .jsp file is created or accessed within Composer.
Creating a New File
- In Composer or Composer Design perspective, create a new Grammar file as follows:
- Select File > New > Composer > Others> Grammars, then select one of the following:
- Grammar Builder file
- GrammarXML file
Create a new XML file as follows:
- Select File > New > Composer > Others and then select one of the following:
- CallControlXML file
- SCXML File
- VoiceXML File
For Server-Side pages:
- Select File > New > > Composer > Server-Side Pages and then select one of the following:
- ASP (ASP.NET) File
- Backend ASPX (ASP.NET) file)
- Backend_JSP_File
- Click Next.
- Select the destination for the new file (usually within an existing Project's src folder).
- Type a file name for your new file and click Next.
- You have two choices:
- To create a code template, click Create VoiceXML file from template and click Next. Select the template. The new file will be populated with sample code usually used in the type of file addressed by the template.
- Click Create VoiceXML file using. Click Next and select the entry from the catalog.
- Click Finish.
The editor opens with your new file. When working with XML files, the view contains Source and Design tabs. All editor functions described at the top of this topic are available to you. The appropriate Composer editor also opens whenever you open an existing .vxml, .ccxml, .grxml, .aspx, or .jsp file, whether previously created as described above, or previously imported into Composer.
Open an Existing File
Open an existing file as follows:
- Select File > Open File and navigate to the file to open, OR
Open a Composer Project's src or src-gen folder in the Project Explorer, then double-click the file to open it in the editor.
Creating a Custom Code Template
When writing manual SCXML/VXML/CCXML/GRXML code in the file editors, you may run into code that becomes repetitive. You may consider creating a code template to avoid retyping this block of code. Creating templates will improve the speed and consistency for writing code. The following steps show how to create a code template.
- Select Window > Preferences.
- In the Preferences dialog box, navigate through the Composer category, and expand the file type (VXML Files / CCXML Files / GRXML / SXCML Files) in which you want to add your template. Then select the Templates section. For example, select VXML Templates.
- Click the New button to add a new code template.
- Fill in the fields for the new template. The Context drop down box specifies at what context level you want the code template to appear as a context sensitive help.
- Click the OK button when finished.
XML File Preferences
You can also set XML File Preferences: Window > Preferences > XML > XML Files. When specifying Encoding formats in the XML Preference page: encoding formats are applicable only for new File creation using the Template option: (File > New > XML > XML File > Create XML File from an XML Template > Select XML Template). This applies only to new XML, VXML, CCXML and SCXML files. Existing files within the Project will not get impacted.
Creating a Backend JSP File
- Create a new JSP file by selecting File > New > Backend JSP file.
- In the Create Backend JSP File folder, navigate to the src folder within the Java Composer Project in which the Backend JSP file belongs.
- Type a name In the File Name field.
- Click Finish.
The Editor opens with a JSP file template. You can see your new file in the src folder of your Java Composer Project in the Project Explorer. A template is provided when you create a new Backend JSP file in Composer. You implement a performLogic method as a JSON object, store a result and return it to the voice application if desired. You have the flexibility to enter any valid JSP code that you wish.
Creating a Backend ASP .NET File
- Create a new ASP.NET file by selecting File > New > Backend ASPX file.
- In the ASPX File folder, navigate to the include folder within the .NET Composer Project in which the Backend ASPX file belongs.
- Type a name In the File Name field.
- Click Finish.
The Editor opens with an ASPX file template. You can see your new file in the include folder of your .NET Composer Project in the Project Explorer. A template is provided when you create a new Backend ASPX file in Composer. You implement a performLogic method as a JSON object, store a result and return it to the voice application if desired. You have the flexibility to enter any valid ASP.NET/C# code that you wish.
