It is possible to create and edit survey elements programmatically using the XML Editor.
1: Accessing the XML
To access the XML for your survey, select "Edit XML" in the Build menu of the Portal or Survey Editor:
2: XML Editor Overview
1. Navigation Menu: Easily navigate through the different phases of your project, from building and testing to reviewing the report and downloading your data.
2. Project Name: Displays the name of the project. Click the project name to access the project page. Click here to learn more.
3. Actions Menu: Contains useful actions, supported by keyboard shortcuts.
- Save (ctrl+enter)
- Revert to Last Save
- Undo (ctrl+z)
- Redo (ctrl+shift+z)
- Find (ctrl+f)
- Find Next (ctrl+g)
- Find Previous (ctrl+shift+g)
- Replace (ctrl+shift+f)
- Upload System Files
- Replace All (ctrl+shift+r)
4. View Options: Allows you to show any errors in the XML (keyboard shortcut: ctrl+shift+f).
5. Survey XML: This field allows you to edit the survey XML.
6. Test Survey: Saves any unsaved changes and opens the survey for testing.
7. Save: Save changes made to the survey XML.
Click the "Save" button to save changes periodically. If the changes you're attempting to save contain errors a warning message will appear and the changes will be identified for you.
Once you've finished making changes, be sure to save them. Then you may select "Test Survey" to review the survey, or use the navigation menu along the top of the screen to navigate to another location. If there are unsaved changes when you attempt to navigate away from the XML, you will be asked if you'd like to stay on the page or leave. If you choose to leave, your changes will be lost.
Warning: If you close the browser window that contains the survey XML, any unsaved changes will be lost.
If you return to the building application, you will see the message below. Follow the instructions in the message and the changes made in the XML will appear in your survey.
2.1: Tags Not Supported by the Survey Editor
The following tags are NOT supported by the Survey Editor and will cause validation errors:
<comment>is invalid (however, <comment> tags inside questions are valid)
<group>tags are supported to a maximum level of 1
“doit”is no longer supported as an attribute for a
Any of these (and macros!) are valid within a
<blackbox> tag, which is editable in the Survey Editor. An example would be:
<blackbox id="UNIQUE1" label="bar"> <arg id="UNIQUE2" name="label" datatype="str">bar</arg> <arg id="UNIQUE3" name="code" datatype="longstr"/> <code> <exec> print 'Hello, world!' </exec> </code> </blackbox>
2.2: Now Accepted in the Survey Editor
<exec>elements can now be added via the structural elements
<res>(intermediate support): viewable through the “actions” menu.
<pipe>(intermediate support): appears in the question tree and stage.
“style”are now allowed on
<exit>tags (child tags of
<title>can be used within a
<samplesource>tag instead of the
“list”attribute of a
<samplesource>tag supports string data.
“invalid”attribute of a
<samplesource>tag is allowed.
<survey>attributes are now supported
“cond”attribute is supported on a
“incidence”attribute is supported on a
“database”attributes are supported on
<var>tags (child tags of
<samplesource>tags). If you use these tags you will be shown a warning when going to edit sample sources in the Survey Editor.
<if>tags will be converted to
<random>tags will be converted to
<net>tags (children of question-type tags)
<nets>tags (children of
<sbase>tag is available to
<survey>and question-type tags
<onLoad>tag is available most everywhere
<weights>tag is available as a child of the
<alt>tag is available as child of question-type tags. It will be converted to an attribute by the XML Editor.
<alt>tags as children of
<survey>tags will remain tags.
<suspend/>tags are automatically inserted into the survey (as currently required by the Survey Editor) if they do not already exist.