3.3.1. Items

class pyslet.qtiv2.items.AssessmentItem(parent)

Bases: pyslet.qtiv2.core.QTIElement, pyslet.qtiv2.core.DeclarationContainer

An assessment item encompasses the information that is presented to a candidate and information about how to score the item:

<xsd:attributeGroup name="assessmentItem.AttrGroup">
        <xsd:attribute name="identifier" type="string.Type" use="required"/>
        <xsd:attribute name="title" type="string.Type" use="required"/>
        <xsd:attribute name="label" type="string256.Type" use="optional"/>
        <xsd:attribute ref="xml:lang"/>
        <xsd:attribute name="adaptive" type="boolean.Type" use="required"/>
        <xsd:attribute name="timeDependent" type="boolean.Type" use="required"/>
        <xsd:attribute name="toolName" type="string256.Type" use="optional"/>
        <xsd:attribute name="toolVersion" type="string256.Type" use="optional"/>
</xsd:attributeGroup>

<xsd:group name="assessmentItem.ContentGroup">
        <xsd:sequence>
                <xsd:element ref="responseDeclaration" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="outcomeDeclaration" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="templateDeclaration" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="templateProcessing" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="stylesheet" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="itemBody" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="responseProcessing" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="modalFeedback" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
</xsd:group>
SortDeclarations()

Sort each of the variable declaration lists so that they are in identifier order. This is not essential but it does help ensure that output is predictable. This method is called automatically when reading items from XML files.

RenderHTML(itemState, htmlParent=None)

Renders this item in html, adding nodes to htmlParent. The state of the item (e.g., the values of any controls and template variables), is taken from itemState, a variables.ItemSessionState instance.

The result is the top-level div containing the item added to the htmlParent. If htmlParent is None then a parentless div is created. If the item has no itemBody then an empty Div is returned.

AddToContentPackage(cp, lom, dName=None)

Adds a resource and associated files to the content package.