From 6af98025d710e86ae242c7dab43a98ddd2130fd2 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Mon, 21 May 2007 13:11:06 +0000 Subject: [PATCH] merged from STABLE18 --- question/format/xml/format.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/question/format/xml/format.php b/question/format/xml/format.php index f7b337d891..fe92c256a3 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -142,7 +142,7 @@ class qformat_xml extends qformat_default { // question name $qo->name = $this->getpath( $question, array('#','name',0,'#','text',0,'#'), '', true, $error_noname ); - $qo->questiontext = $this->getpath( $question, array('#','questiontext',0,'#','text',0,'#'), '', true, $error_noquestion ); + $qo->questiontext = $this->getpath( $question, array('#','questiontext',0,'#','text',0,'#'), '', true ); $qo->questiontextformat = $this->getpath( $question, array('#','questiontext',0,'@','format'), '' ); $image = $this->getpath( $question, array('#','image',0,'#'), $qo->image ); $image_base64 = $this->getpath( $question, array('#','image_base64','0','#'),'' ); @@ -162,8 +162,8 @@ class qformat_xml extends qformat_default { * @return object answer object */ function import_answer( $answer ) { - $fraction = $answer['@']['fraction']; - $text = $this->import_text( $answer['#']['text']); + $fraction = $this->getpath($answer, array('@','fraction'), 0); + $text = $this->getpath( $answer, array('#','text',0,'#'),'',true); $feedback = $this->import_text( $answer['#']['feedback'][0]['#']['text'] ); $ans = null; @@ -458,12 +458,8 @@ class qformat_xml extends qformat_default { $answer = $question['#']['answer'][0]; // get fraction - tag is deprecated - if (!empty($answer['#']['fraction'][0]['#'])) { - $qo->fraction = $answer['#']['fraction'][0]['#']; - } - else { - $qo->fraction = $answer['@']['fraction'] / 100; - } + $qo->fraction = $this->getpath( $question, array('@','fraction'), 0 ) / 100; + $q0->fraction = $this->getpath( $question, array('#','fraction',0,'#'), $qo->fraction ); return $qo; } -- 2.39.5