Question Document Elements and Attributes

Question Document XML Element: question-document

This is the outermost tag pair. It is required to have this. This element can contain one or more topic elements. The questions defined within a question document are expected to form one or more topics within a questionlist, although there is no mechanism that enforces this. A Question Document file contains a set of topics that will be implemented in a single pair of files: one "java" file that deals with generating values for the questions and calculating answers and one "jsp" file that deals with displaying the questions. There are 3 attributes that are required on the opening question-document tag for use in determining the naming and placing of the files produced:-

package

The word "package" derives from the Java programming system, where a package is means of grouping together of related Java files, so as to differentiate them from other groups of files, which might potentially have file names in common: much as street names allow house numbers to be the same on different streets. A Java package has a name, just a street does. The Java files produced by the question generation system are grouped into packages: the names of the packages are used in the directory structure to define where the Java files are stored. The package name is entered in the package attribute, and it is anticipated that the name will reflect the question content. It is also anticipated that question groups in a similar area, would use the same package name.

class

This attribute defines the name to be given to the Java file created for the questions defined within the courswork tags ["class" is a another programming term: a java file defines a "class"]. It is anticipated that the name will reflect the question content. The class name should be different from other class names with the same package name. It is allowed to have the same class name in different packages, although this can cause confusion, and is less likely to occur if names are related to content.

jsp

This attribute defines the name to be given to the JSP file created for the questions defined within the courswork tags. It is anticipated that the name will reflect the question content. The jsp name should be different form other class names with the same package. It is allowed to have the same jsp name in different packages, although this can cause confusion, and is less likely to occur if names related to content. There is no defined package mechanism for JSP files, but within ExerTran a directory structure is maintained for JSP files, that uses the package name defined for the coursework tag, so that JSP files with the same name but being associated with different "package" names are stored separately and can thus co-exist within ExerTran.

Question Document XML Element: topic

This element contains a set of "question" elements, that each contains a set of questions. There are 2 attributes:

name

this defines the string that is used to form the first part of the "question number" for the questions in the topic. This string must be unique for each topic element. This attribute must be present.

title

this defines the title to be displayed in the question list against the topic.

Question Document XML Element: question

This element defines a question. The following elements are allowed within the content of this element:-

question-messageanswer-text
question-partcondition
variablequestionnaire
equationwrong-answer-response
answer-integerhelpfile
stringscomment
answer-double 

A question element can have the following attributes:-

name: this value is the question number or identifier within the topic. It is used with the topic name attribute to generate a unique reference for the question, the "question number". This attribute must be present and mus be unique for each question within a topic.
mark: this gives the overall mark for this question, and it may be greater than the sume of the part marks, i.e. there may be a reward for getting all parts correct. This attribute must be present.
type: this indicates the number of attempts at the question, and its value is restricted to "single" with only one attempt, "multi" with any number of attempts allowed, or a positive integer, which is planned to give a limited number of attempts. [The last has yet to be implemented.] "Multi" is the default when this attribute is missing.
optional: if this attribute is present, then the question is optional. This attribute has no value, i.e. it appears without an "=" sign and following value. If this attribute is absent, then question has to be answered.
awardPartMarks: this can the value "true" or "false". The former allows marks to be awarded when parts of the question are correct and the others incorrect. The latter only awards a mark when all parts of the question are answered correctly: this is the default value when this attribute is absent. See the Section called Question Document XML Element: question-part.

Question Document XML Element: question-message

The content of this element is text that is displayed at the start of the question: the text is likely to general infomration covering all parts of the quesion. The content may contain an image. There can be only one question-message element in a question element.

Question Document XML Element: image

This is an "empty" element: this is a particular form of element within XML, that has only an opening tag and no content. The opening tag has a "/" character after the tag name, e.g. <xyx/> is an empty element. Empty elements usually have attributes. The "image" element has a single attribute "src", which gives the file path to an image file, usually a jpg file. An example image element si:-


                 <image src="images/sinewave.jpg"/>
        

Question Document XML Element: question-part

A question may have one or more sub-parts, each defined within a "question-part" element. The content of the element is text detailing the question asked by this part. The content may contain an image element. This element has two attributes: a required "part" attribute that provides an identifier for the question-part within the question, and an optional "partMark" attribute that gives the number of marks assigned to this part. If the latter is absent, then a the overall marks for the question are shared equally among the parts.

Question Document XML Element: variable

This element defines one more variables: a variable has a name and a value, and can be used in a Java statement in an equation element or a Java expression in one of the answer elements, e.g. answer-double. The content of this element is one more of the following elements:

set
random
fixed

Question Document XML Element: set

This element is usually an empty element: see image element for an explanation of this. This element defines a variable and the element has a "values" attribute, which defines a set of numbers. On each question attempt, the variable is assigned at random one of this set of values. It has the following attributes:-

name: the name of the set variable, by which the variable's value can be accesses from within Java statements and expressions
values: a comma separate list of numbers - these identify the set of values that the variable can take on.
type: the type of the variable's value: either "integer" or "double". The default value is integer if this attribute is missing.
message: a message that relates to the variable, and is displayed next to the variables assigned value in the question display.

Question Document XML Element: random

This element is usually an empty element: see image element for an explanation of this. This element defines a variable and the element has three attributes, which define a minimum value, a maximum value and an increment value. These values yield a set of valued, obtained by successively adding the increment value to the mimimum value, stopping when the maximum value is reached. On each question attempt, the variable is assigned at random one of this set of values. It has the following attributes:-

name: the name of the set variable, by which the variable's value can be accesses from within Java statements and expressions
type: the type of the variable's value: either "integer" or "double". The default value is integer if this attribute is missing.
low: the minimum value the variable can be assigned.
high: the maximum value the variable can be assigned.
step: the increment added to the mimumum value to generate successive values.
message: a message that relates to the variable, and is displayed next to the variables assigned value in the question display.

Question Document XML Element: fixed

This element is usually an empty element: see image element for an explanation of this. This element defines a variable with a constant value. It has the following attributes:-

name: the name of the set variable, by which the variable's value can be accesses from within Java statements and expressions
type: the type of the variable's value: either "integer" or "double". The default value is integer if this attribute is missing.
vale: the value assigned to the variable.
message: a message that relates to the variable, and is displayed next to the variables assigned value in the question display.

This variable is not strictly required, as it effects can be produced in other ways, but it is useful in a number of circumstances to make the Java expressions and statements clearer and more understandable.

Question Document XML Element: equation

The content of this element are Java statements, that are placed verbatim into the Java file produced from the Question Document. The Java statements can be used to calculate values from the defined variables and other numbers for use in the answer elements.

Question Document XML Element: answer-integer

This element defines how the answer to a question part, defined in a question-part element, is calculated. The content of the element is a Java expression, that uses the variables and values assigned or calculated in any equation element. The expression is evaluated on each question attempt to generate the answer. The expression will produce an integer value. The element has the following attributes:

part: the value is an identifier that must match the identifier in one of the question-part elements in the containing question element.
units: this attribute defines the text to be displayed next to the display of the answer, if it is displayed. The text is expected to be the units of the answer, e.g. "mph"
precisionPercent: this attribute specifies how close the submitted answer must be the correct answer for it to be accpeted as correct. It specifies the percentage difference for the correct answer: a 0 value defines that the answer must be exact. The default value is 0, if the attribute is missing.
showAnswer: value is true if the correct answer is to be output in response to a incorrect answer being submitted, or false if it is not to be displayed. The default value if the attribute is missing is true.

Question Document XML Element: answer-double

This element defines how the answer to a question part, defined in a question-part element, is calculated. The content of the element is a Java expression, that uses the variables and values assigned or calculated in any equation element. The expression is evaluated on each question attempt to generate the answer. The expression will produce a value with java type double. The element has the following attributes:

part: the value is an identifier that must match the identifier in one of the question-part elements in the containing question element.
units: this attribute defines the text to be displayed next to the display of the answer, if it is displayed. The text is expected to be the units of the answer, e.g. "mph"
precisionPercent: this attribute specifies how close the submitted answer must be the correct answer for it to be accpeted as correct. It specifies the percentage difference for the correct answer: a 0 value defines that the answer must be exact, and this should not used for this element, as there is always some possiblity with values of type double, that there will be some very slight difference between the input value and the calculated answer, e.g. an input answer of 0.6 is not exactly the same as a calculated value of 0.5999999999. The default value is
precisionPower: this attribute provides a second means to specify how close the submitted answer must be the correct answer for it to be accpeted as correct. It specifies the maximum allowed fractional difference from the correct answer through the log to base 10 of this difference. CHECK THIS!
showAnswer: value is true if the correct answer is to be output in response to a incorrect answer being submitted, or false if it is not to be displayed. The default value if the attribute is missing is true.

Question Document XML Element: answer-text

This element defines how the answer to a question part, defined in a question-part element, is calculated. The content of the element is a Java expression, that uses the variables and values assigned or calculated in any equation element. The expression is evaluated on each question attempt to generate the answer, which is of Java type String. The element has the following attributes:

part: the value is an identifier that must match the identifier in one of the question-part elements in the containing question element.
units: this attribute defines the text to be displayed next to the display of the answer, if it is displayed. The text is expected to be the units of the answer, e.g. "mph"
showAnswer: value is true if the correct answer is to be output in response to a incorrect answer being submitted, or false if it is not to be displayed. The default value if the attribute is missing is true.

HOW IS CHECKING DONE - space removed etc

Question Document XML Element: question

Question Document XML Element: questionnaire

This element defines a set of possible answers to a question part, defined in a question-part element, in a "questionnaire" calculated. The student selects one of the answers. This element should contain two or more sub-answers elements. The element has the following attributes:

part: the value is an identifier that must match the identifier in one of the question-part elements in the containing question element.
showAnswer: value is true if the correct answer is to be output in response to a incorrect answer being submitted, or false if it is not to be displayed. The default value if the attribute is missing is true.

Question Document XML Element: sub-answer

The content of this element is the text of this sub-answer. It has a the following attributes:

truth: this is either "true" or "false" as the question statement is true or false. The default is false if the attribute is missing.
ref: the attribute is identifier to uniquely identify each sub-answer within a questionnaire element. When a student's attempt is stored the reference is saved rather than the sub-answer text.

sub-answer elements.

Question Document XML Element: wrong-answer-response

The content of this page is the text to display when an answer is incorrect. The element is optional, and in its absence there is a default response. For questions with multiple attempts allowed, the submitted and correct answer are diaplsyed on a "wrong" answer.

Question Document XML Element: helpfile

This is an empty element: see image element for an explanation of an empty element. The "helpfile" element has a single attribute, which is the relative part from the help file directory to a help page for this question.

Question Document XML Element: comment

The content of this element is ignored: it is for documenting the XML file.

Question Document XML Element: strings