Skip to content

Commit

Permalink
Ability to load and save 2.2 content.
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jun 9, 2016
1 parent bbed471 commit a4f7219
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "qtism/qtism",
"description": "OAT QTI Software Module Library",
"type": "library",
"version": "0.9.31",
"version": "0.9.32",
"authors": [
{
"name": "Open Assessment Technologies S.A.",
Expand Down
34 changes: 19 additions & 15 deletions qtism/data/storage/xml/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,25 @@ public static function inferQTIVersion(DOMDocument $document) {
}
else {
switch (trim($root->lookupNamespaceURI(null))) {
case 'http://www.imsglobal.org/xsd/imsqti_v2p1':
return '2.1';
break;

case 'http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p1':
return '2.1';
break;

case 'http://www.imsglobal.org/xsd/imsqti_v2p0':
return '2.0';
break;

default:
return false;
break;
case 'http://www.imsglobal.org/xsd/imsqti_v2p1':
return '2.1';
break;

case 'http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p1':
return '2.1';
break;

case 'http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p2':
return '2.2';
break;

case 'http://www.imsglobal.org/xsd/imsqti_v2p0':
return '2.0';
break;

default:
return false;
break;
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions qtism/data/storage/xml/XmlDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ protected function decorateRootElement(DOMElement $rootElement) {
$qtiSuffix = 'v2p0';
$xsdLocation = 'http://www.imsglobal.org/xsd/imsqti_v2p0.xsd';
break;

case '2.2':
$qtiSuffix = 'v2p2';
$xsdLocation = 'http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd';
break;
}

$rootElement->setAttribute('xmlns', "http://www.imsglobal.org/xsd/imsqti_${qtiSuffix}");
Expand Down

0 comments on commit a4f7219

Please sign in to comment.