This page is meant for AI assistants (ChatGPT, Claude, Gemini, …) that create a file for SoSci Survey users, which the users then import into their survey project. The file contains questions (one section in the list of questions) and, optionally, a questionnaire that arranges these questions on pages.
Related pages:
.xml).The example contains a section “LI” with a welcome text and three questions (selection, scale, open text input), English texts with a German translation, and a questionnaire with two pages and a filter.
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE surveyContent SYSTEM "https://www.soscisurvey.de/templates/doctype.survey.dtd"> <surveyContent version="2.5"> <program>SoSci Survey</program> <version>4.0.03</version> <timestamp>2026-11-25 12:00:00</timestamp> <title>Library Satisfaction</title> <description>Short questionnaire on library use and satisfaction</description> <language>eng</language> <attributes.specific program="ofb"> <attr id="language">eng</attr> <attr id="translations">ger</attr> </attributes.specific> <section> <title>Library</title> <attributes.specific program="ofb"> <attr id="id">LI</attr> </attributes.specific> <question> <description>Welcome</description> <class>TextContent</class> <title /> <explanation /> <headerText> <txt>Welcome</txt> <txt lng="ger">Willkommen</txt> </headerText> <lead> <txt><![CDATA[Thank you for taking part in our survey. It takes about 3 minutes.]]></txt> <txt lng="ger"><![CDATA[Vielen Dank, dass Sie an unserer Befragung teilnehmen. Die Beantwortung dauert etwa 3 Minuten.]]></txt> </lead> <attributes.specific program="ofb"> <attr id="id">1</attr> </attributes.specific> </question> <question> <description>Frequency of use</description> <class>select</class> <title> <txt>How often do you use the library?</txt> <txt lng="ger">Wie oft nutzen Sie die Bibliothek?</txt> </title> <explanation /> <attributes.specific program="ofb"> <attr id="id">2</attr> <attr id="restrictions.answered">yes</attr> </attributes.specific> <item> <text> <txt>several times a week</txt> <txt lng="ger">mehrmals pro Woche</txt> </text> <attributes.specific program="ofb"> <attr id="id">1</attr> </attributes.specific> </item> <item> <text> <txt>about once a week</txt> <txt lng="ger">etwa einmal pro Woche</txt> </text> <attributes.specific program="ofb"> <attr id="id">2</attr> </attributes.specific> </item> <item> <text> <txt>less often</txt> <txt lng="ger">seltener</txt> </text> <attributes.specific program="ofb"> <attr id="id">3</attr> </attributes.specific> </item> <item> <text> <txt>never</txt> <txt lng="ger">nie</txt> </text> <attributes.specific program="ofb"> <attr id="id">4</attr> </attributes.specific> </item> </question> <question> <description>Satisfaction</description> <class>scale</class> <title> <txt>To what extent do you agree with the following statements?</txt> <txt lng="ger">Inwieweit stimmen Sie den folgenden Aussagen zu?</txt> </title> <explanation /> <labels> <li i="1"> <txt>strongly disagree</txt> <txt lng="ger">stimme überhaupt nicht zu</txt> </li> <li i="5"> <txt>strongly agree</txt> <txt lng="ger">stimme voll und ganz zu</txt> </li> </labels> <residualOptions> <li i="0"> <txt>don't know</txt> <txt lng="ger">weiß nicht</txt> </li> </residualOptions> <attributes.specific program="ofb"> <attr id="id">3</attr> <attr id="scale.niveau">5</attr> </attributes.specific> <item> <text> <txt>I find the books I am looking for.</txt> <txt lng="ger">Ich finde die Bücher, die ich suche.</txt> </text> <attributes.specific program="ofb"> <attr id="id">1</attr> </attributes.specific> </item> <item> <text> <txt>The opening hours suit my daily life.</txt> <txt lng="ger">Die Öffnungszeiten passen zu meinem Alltag.</txt> </text> <attributes.specific program="ofb"> <attr id="id">2</attr> </attributes.specific> </item> <item> <text> <txt>It is often too noisy for me.</txt> <txt lng="ger">Es ist mir oft zu laut.</txt> </text> <invert>yes</invert> <attributes.specific program="ofb"> <attr id="id">3</attr> </attributes.specific> </item> </question> <question> <description>Reasons for not using</description> <class>text</class> <title> <txt>Why don't you use the library?</txt> <txt lng="ger">Warum nutzen Sie die Bibliothek nicht?</txt> </title> <explanation /> <attributes.specific program="ofb"> <attr id="id">4</attr> </attributes.specific> <item> <text /> <attributes.specific program="ofb"> <attr id="id">1</attr> <attr id="height">120</attr> </attributes.specific> </item> </question> </section> <questionnaire> <title>Library Survey</title> <attributes.specific program="ofb"> <attr id="id">library</attr> <attr id="content"><?xml version="1.0"?> <questionnaire> <page> <question id="LI01" /> <question id="LI02" /> </page> <page> <php><![CDATA[ if (value('LI02') == 4) { question('LI04'); } else { question('LI03'); } ]]></php> </page> </questionnaire></attr> </attributes.specific> </questionnaire> </surveyContent>
<?xml version="1.0" encoding="UTF-8" ?> and the <!DOCTYPE ...> line as in the example. The file must be UTF-8 encoded.<surveyContent version="2.5"> contains, in this order: <program>, <version>, <timestamp>, <title>, <description>, <language>, <attributes.specific> (languages), exactly one <section> and optionally exactly one <questionnaire>.<title> and <description> describe the file. SoSci Survey suggests the name of the questionnaire based on the title during the import.eng (English), ger (German), fre (French), spa (Spanish), ita (Italian).<language> and <attr id="language"> state the base language, <attr id="translations"> the translations (several separated by commas). Without translations, <attr id="translations"> is omitted.<txt> without lng for the base language and one <txt lng="..."> per translation. Without translations, the text may also be written directly in the element: <title>How old are you?</title>.<section>) has a title and an ID of two capital letters (<attr id="id">LI</attr>). The user may choose another ID during the import; references in the questionnaire are then adjusted automatically.<attr id="id">). It makes up the question ID: section + two-digit number, e.g. LI02. This ID is used in the questionnaire and in PHP code.<attr id="id">), which also is the response code in selection questions. The variable of an item is named e.g. LI03_01 (question LI03, item 1). In selection questions (select, dropdown), the variable of the question (LI02) stores the code of the selected option.<attr id="pos">) may be omitted; then the order in the file applies.<question> element always needs <description> (internal description, not visible to respondents), <class> (the question type), <title> (the question text) and <explanation> (instructions) – empty as <title /> or <explanation />.<question> and <item> have a fixed order. The reference states this order, and which attributes are elements of their own and which are written as <attr id="..."> in <attributes.specific program="ofb">.yes and no. Widths and heights are given in pixels. Only specify a height for a text input if the field shall have several lines (at least 32 pixels).scale, gradual, slider, polar) with <labels>: i is the scale value, e.g. i="1" for the minimum and i="5" for the maximum of a 5-point scale (<attr id="scale.niveau">5</attr>). A residual option (“don't know”) goes into <residualOptions> with i="0" and is stored with the code -1.<, & or HTML tags in <![CDATA[ ... ]]>.TextContent. In the file, they are nevertheless written as <question> in the section and get an ID like a question: the heading in <headerText>, the text in <lead>.<questionnaire> contains <title> and, in <attributes.specific>, the name (<attr id="id">, up to 40 characters: letters without umlauts, digits, - and _) and the content (<attr id="content">).& becomes &, < becomes <, > becomes >. The content must start with <?xml version="1.0"?> (escaped: <?xml version="1.0"?>).<page> elements in the order of the pages. A page contains:<question id="LI02" /> – a question from the list of questions<php><![CDATA[ ... ]]></php> – PHP code, e.g. for filters (see below)<html><![CDATA[ ... ]]></html> – HTML code that is placed directly on the pageintID (internal numbers) may be omitted; SoSci Survey adds them.value() reads responses from previous pages, e.g. value('LI02') for the code of the selected option. question('LI04') displays a question, goToPage() jumps to another page.echo, $_GET/$_POST, global variables as well as file and database access are not possible. Details: SoSci Survey PHP Sandbox Context.
A project file (root element <surveyProject>) contains a complete project: several sections, several questionnaires, text elements and settings. Only use it if the user explicitly wants a complete project, e.g. for a new, empty project.
<surveyProject version="2.5" progversion="4.0.03"> with <title>, <description>, <attributes.specific> (languages as above), followed by any number of <section> and <questionnaire> (order according to the DTD: section before questionnaire).<attr id="pos">). The IDs are not adjusted, so references in the questionnaire must match the IDs in the file.version="2.5" as in the example, file in UTF-8.<description>, <class>, <title> and <explanation> in this order, the other elements in the order of the reference.LI04) exists in the section.<?xml version="1.0"?>.<form>, <input>) in texts: such inputs are not stored. Use the question types for inputs.