Representation of KCM FORM elements

This section shows what XForms primitives and structures are used to represent questions on KCM forms.

See XForms 1.0 reference documentation for details on XForms functionality.

TEXT question

Text questions are directly mapped onto <xforms:input> elements. Default values are directly written into the XForms instance data. The length attribute is encoded in the XSchema declaration.

QUESTION "Text question"

LEN (16)

DFT "dft"

ANSWER text_variable

<xsd:schema targetNamespace="http://example.info/types">
<xsd:simpleType name="question0">
<xsd:restriction base="string" />
<xsd:length value='16' />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0>dft</question0>
</response>
</xforms:instance>
<xforms:bind nodeset="question0" id="question0" type="type:question0" />
<itp:question>
<xforms:input ref="question0">
<xforms:label>Text question</xforms:label>
</xforms:input>
</itp:question>

NUMBER question

Number questions are directly mapped into <xforms:input> elements. Default values are directly written into the XForms instance data. The length attribute is encoded in the XSchema declaration.

QUESTION "Number questions"

LEN (12 3)

DFT 43

ANSWER number_variable

<xsd:schema targetNamespace="http://example.info/types">
<xsd:simpleType name="question0">
<xsd:restriction base="decimal">
<xsd:totalDigits value="12" />
<xsd:fractionDigits value="3" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0>42.000</question0>
</response>
</xforms:instance>
<xforms:bind nodeset="question0" id="question0" type="type:question0" />
<itp:question>
<xforms:input ref="question0">
<xforms:label>Number question</xforms:label>
</xforms:input>
</itp:question>

BOOLEAN question

Boolean questions are represented as a multi-select <xforms:select> with only a single option to select. Default values are directly written into the XForms instance data.

QUESTION "Boolean question"

DFT FALSE

ANSWER bool_variable

<xsd:schema targetNamespace="http://example.info/types">
<xsd:simpleType name="question1">
<xsd:restriction base="string" />
</xsd:simpleType>
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0 />
</response>
</xforms:instance>
<xforms:bind nodeset="question1" id="question1" type="type:question1" />
<itp:question>
<xforms:select ref="question0" appearance="full">
<xforms:label>Boolean question</xforms:label>
<xforms:item>
<xforms:value>TRUE</xforms:value>
</xforms:item>
</xforms:select>
</itp:question>

FILE attribute

Text questions with a FILE attribute ask for a filename. KCM ComposerUI downloads that file from the client into the server. A FILE question requires two elements in the <response> structure:

  • <questionX>: The name of the downloaded file.
  • <questionX-local>: The name as selected on the client.

An application that generates the <response> structure needs only to ensure that the <questionX> file exists. The <questionX-local> element is optional.

QUESTION "File question"

FILE

DFT "C:\My Documents\sample.doc"

ANSWER text_variable

<xsd:schema targetNamespace="http://example.info/types">
<xsd:simpleType name="question0">
<xsd:restriction base="anyURI" />
</xsd:simpleType>
<xsd:simpleType name="question0-local">
<xsd:restriction base="string" />
</xsd:simpleType>
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0 />
<question0-local>
c:\My Documents\sample.doc
</question0-local>
</response>
</xforms:instance>
<xforms:bind nodeset="question0" id="question0" type="type:question0" />
<xforms:bind nodeset="question0-local" id="question0-local" type="type:question0-local" />
<itp:question>
<xforms:upload ref="question0">
<xforms:label>File question</xforms:label>
<xforms:filename ref="../question0-local" />
</xforms:upload>
</itp:question>

DATE attribute

Number questions with a DATE attribute ask for a date to be entered. The interactive clients can represent this with a date picker. The resulting date should be written in the XScheme xsd:date YYYY-MM-DD format.

QUESTION "Date question"

DATE

DFT 20060307

ANSWER number_variable

<xsd:schema targetNamespace="http://example.info/types">
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0>2006-03-07</question0>
</response>
</xforms:instance>
<xforms:bind nodeset="question0" id="question0" type="xsd:date" />
<itp:question>
<xforms:input ref="question0">
<xforms:label>Date question</xforms:label>
</xforms:input>
</itp:question>

TIME attribute

Number questions with a TIME attribute ask for a time to be entered. The interactive clients can represent this with a time picker. The resulting time should be written in the XScheme xsd:time HH:MM:SS format.

QUESTION "Time question"

DATE

DFT 211632

ANSWER number_variable

<xsd:schema targetNamespace="http://example.info/types">
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0>21:16:32</question1>
</response>
</xforms:instance>
<xforms:bind nodeset="question0" id="question0" type="xsd:time" />
<itp:question>
<xforms:input ref="question0">
<xforms:label>Time question</xforms:label>
</xforms:input>
</itp:question>

MULTISELECT questions

Multiselect questions expect a list of elements as their response. Since spaces are used as separators in the list, the elements are encoded.

Each element is Base-64 encoded and starts with an "@". Any whitespace is ignored.

QUESTION "Text list question"

VALUES ( "qqqwww1";

"qqqwww2";

"qqqwww3";

"qqqwww4";

"The quick brown fox jumps over the lazy dog")

DFT "qqqwww1"

ANSWER text_list

<xsd:schema targetNamespace="http://example.info/types">
<xsd:simpleType name="question0">
<xsd:restriction base="string" />
</xsd:simpleType>
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0>@cXFxd3d3MQ==</question0>
</response>
</xforms:instance>
<xforms:bind nodeset="question0" id="question0" type="type:question0" />
<itp:question>
<xforms:select ref="question0">
<xforms:label>Text list question</xforms:label>
<xforms:item>
<xforms:label>qqqwww1</xforms:label>
<xforms:value>@cXFxd3d3MQ==</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>qqqwww2</xforms:label>
<xforms:value>@cXFxd3d3Mg==</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>qqqwww3</xforms:label>
<xforms:value>@cXFxd3d3Mw==</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>qqqwww4</xforms:label>
<xforms:value>@cXFxd3d3NA==</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>
	The Quick Brown Fox Jumps Over The Lazy Dog.
</xforms:label>
<xforms:value>
	@VGhlIFF1aWNrIEJyb3duIEZveCBKdW1wcyBP
dmVyIFRoZSBMYXp5IERvZy4=
</xforms:value>
</xforms:item>
</xforms:select>
</itp:question>

READONLY questions

Readonly questions are tagged in the XForms binding. Values in the <response> element are ignored on submission.

QUESTION "Text question (read-only)"

READONLY TRUE

DFT "dft"

ANSWER text_variable

<xsd:schema targetNamespace="http://example.info/types">
<xsd:simpleType name="question0">
<xsd:restriction base="string" />
</xsd:simpleType>
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0>dft</question0>
</response>
</xforms:instance>
<xforms:bind nodeset="question0" id="question0" type="type:question0" readonly="true()" />
<itp:question>
<xforms:input ref="question0">
<xforms:label>Text question (read-only)</xforms:label>
</xforms:input>
</itp:question>

Text Block selections

The Text Block selection through the VIEW question expect a list of elements formatted in the same fashion as the MULTISELECT questions do. Only the Text Block IDs should be encoded in the response.

<xsd:schema targetNamespace="http://example.info/types">
<xsd:simpleType name="question0">
<xsd:restriction base="string" />
</xsd:simpleType>
</xsd:schema>
<xforms:instance>
<response xmlns="">
<question0>@NTAwMw== @NTAwNA==</question0>
</response>
</xforms:instance>
<itp:question>
<itp:paragraph-set>Claims</itp:paragraph-set>
<itp:textblockserver>
<itp:server>textblock-server</itp:server>
<itp:port>7777</itp:port>
<itp:environment>Default</itp:environment>
</itp:textblockserver>
<xforms:select ref="question0">
<xforms:label>Select textblocks</xforms:label>
<xforms:item>
<xforms:label>5003 - Send Invoice</xforms:label>
<xforms:value>@NTAwMw==</xforms:value>
<itp:order>0</itp:order>
</xforms:item>
<xforms:item>
<xforms:label>5004 - Provide Estimate</xforms:label>
<xforms:value>@NTAwNA==</xforms:value>
<itp:order>1</itp:order>
</xforms:item>
<xforms:item>
<xforms:label>5005 - Condition breached - reserve rights</xforms:label>
<xforms:value>@NTAwNQ==</xforms:value>
<itp:order>2</itp:order>
</xforms:item>
… … … …
</xforms:select>
</itp:question>