Author Message

Posted: Thu Jul 25, 2013 7:52 am   Post subject: Parse XML for QuizMakerServer Results

Do you have an already prepared PHP parse template file we can look at? Something along the lines of

Code:
   var $detailed_results_xml = $_POST['dr'];
    var $resParser;
   
    function parse($detailed_results_xml) {       
            
            $this->resParser = xml_parser_create ();
            xml_set_object($this->resParser,$this);
            xml_set_element_handler($this->resParser, "tagOpen", "tagClosed");
           
            xml_set_character_data_handler($this->resParser, "tagData");


Profile profile test

Posted: Fri Aug 02, 2013 2:16 pm   Post subject: Re: Parse XML for QuizMakerServer Results

We only have the following php script to accept incoming Quiz results on the server and save them in xml. I hope it will be helpful.


Profile profile test

Posted: Sun Aug 04, 2013 5:27 am   Post subject: Re: Parse XML for QuizMakerServer Results

Thank you for the files. I will take a look at them.


Profile profile test

Posted: Tue Oct 22, 2013 11:45 pm   Post subject: Re: Parse XML for QuizMakerServer Results

Hi Mikhail:
I'm interested in use the library that you post but I have some Questions before.

Is that code open sourse licenced ?
Is there any kind of documentation ?


Profile profile test

Posted: Thu Nov 07, 2013 4:00 pm   Post subject: Re: Parse XML for QuizMakerServer Results

This sample code is free for use and modification. It is provided as is. Documentation is not available rather than this info in the article:
http://www.ispringsolutions.com/article ... erver.html


Profile profile test

Posted: Tue May 10, 2016 11:27 pm   Post subject: Re: Parse XML for QuizMakerServer Results

I am stuck with getting the value from a XML element list. I wonder if someone here could help? Thanks in advance.

Here is the problem. I have this XML element:

Code:
<sequenceQuestion status="correct" maxPoints="10" maxAttempts="1" awardedPoints="10" usedAttempts="1">
  <direction>Order the following options</direction>
  <answers>
    <answer userDefinedPosition="0">Option 1</answer>
    <answer userDefinedPosition="1">Option 2</answer>
    <answer userDefinedPosition="2">Option 3</answer>
    <answer userDefinedPosition="3">Option 4</answer>
    <answer userDefinedPosition="4">Option 5</answer>
  </answers>
</sequenceQuestion>


And I need to print the elements in the tag. For example, I need to print "Option 1", "Option 2", ... , "Option 5" in a webpage by the order they were selected by the user.

If i use this code:

Code:
$SequenceQuestionNumber = 1;

foreach($answer_group->answers->answer as $userSequenceQuestion){

if($status!="notAnswered" && isset($userSequenceQuestion->attributes()->userDefinedPosition)) {
    $userDefinedPosition = (string)$userSequenceQuestion->attributes()->userDefinedPosition;
    $values .= "\"" . $userDefinedPosition . "\", ";


I get as answer values "0", "1", "2", "3" and "4". But what I need is not the 'userDefinedPosition" but rather the text associated with it. For "0" I need to print "Option 1", for "1" I need "Option 2", for "3" I need "Option 2", etc...

I have tried to build an array like this:
Code:
$answers = (array)$userSequenceQuestion->answer;
$values .= "\"" . $answers[$userDefinedPosition] . "\", ";


but I just get blanks (nothing) printed

I guess what is messing my reference is the userDefinedPosition inside the tag, but I am not sure on how to get the labels instead of the index numbers.

Any comments will be greatly appreciated. Thanks!
JPMD


Profile profile test

Posted: Wed May 11, 2016 8:22 am   Post subject: Re: Parse XML for QuizMakerServer Results

Thank you for your post!

Let me suggest that you take a look at this article on how to send quiz results to server:
http://www.ispringsolutions.com/article ... erver.html

Also, here is a sample PHP script for server to parse quiz results:
https://github.com/ispringsolutions/QuizResults

Also, here is another topic on a similar question:
viewtopic.php?f=2&t=3983

Hope you find this information helpful!


Profile profile test

Posted: Wed May 11, 2016 11:18 am   Post subject: Re: Parse XML for QuizMakerServer Results

... No, it did not help. But the solution was easy. Just use

Code:
$userDefinedPosition = (string)$userSequenceQuestion;


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 8 users online :: 3 registered, 0 hidden and 5 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]