Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-71016

Export user grades as XML doesn't encode user or grade idnumbers

XMLWordPrintable

    • MOODLE_39_STABLE
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • Hide

      Setup

      1. Login as admin
      2. Create two new users:
        1. User: "User 1", ID number: "u1" (without quotes)
        2. User: "User 2", ID number:

          'Bill'&"Ben"<tag>Hello</tag>

      Export

      1. Create a new course
      2. Enrol both users as students
      3. Add an assignment to the course with the following ID number(Common module settings):

        assignment&<code>101</code>

      4. From the assignment page press Grade and give the following:
        1. User 1: 75
        2. User 2: 90
      5. Click on Grades in course navigation
      6. Select Export > XML file
      7. Press Download and save the file to your computer
      8. Open the XML file and confirm the assignment/student entities are encoded correctly, e.g.

        <results batch="xml_export_1614643952">
        	<result>
        		<assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment>
        		<student>u1</student>
        		<score>75.00</score>
        	</result>
        	<result>
        		<assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment>
        		<student>&apos;Bill&apos;&amp;&quot;Ben&quot;&lt;tag&gt;Hello&lt;/tag&gt;</student>
        		<score>90.00</score>
        	</result>
        </results>
        

      Import

      1. Delete the previous course
      2. Create a new course
      3. Enrol both users as students
      4. Add an assignment to the course with the following ID number (Common module settings):

        assignment&<code>101</code>

      5. Click on Grades in course navigation
      6. Select Import > XML file
      7. Upload the file you previously exported
      8. Press Upload grades
      9. Confirm you see the message "Grade import success"
      10. Click on Grades in course navigation
      11. Confirm that each user has the following grade for your assignment as follows:
        1. User 1: 75
        2. User 2: 90
      Show
      Setup Login as admin Create two new users: User: "User 1", ID number: "u1" (without quotes) User: "User 2", ID number: 'Bill'&"Ben"<tag>Hello</tag> Export Create a new course Enrol both users as students Add an assignment to the course with the following ID number(Common module settings): assignment&<code>101</code> From the assignment page press Grade and give the following: User 1: 75 User 2: 90 Click on Grades in course navigation Select Export > XML file Press Download and save the file to your computer Open the XML file and confirm the assignment/student entities are encoded correctly, e.g. <results batch="xml_export_1614643952"> <result> <assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment> <student>u1</student> <score>75.00</score> </result> <result> <assignment>assignment&amp;&lt;code&gt;101&lt;/code&gt;</assignment> <student>&apos;Bill&apos;&amp;&quot;Ben&quot;&lt;tag&gt;Hello&lt;/tag&gt;</student> <score>90.00</score> </result> </results> Import Delete the previous course Create a new course Enrol both users as students Add an assignment to the course with the following ID number (Common module settings): assignment&<code>101</code> Click on Grades in course navigation Select Import > XML file Upload the file you previously exported Press Upload grades Confirm you see the message "Grade import success" Click on Grades in course navigation Confirm that each user has the following grade for your assignment as follows: User 1: 75 User 2: 90

      User & grade idnumber are written without encoding, which can lead to malformed XML

      According to this reference, these characters need encoding in XML text elements

      "   &quot;
      '   &apos;
      <   &lt;
      >   &gt;
      &   &amp;
      

            pholden Paul Holden
            pholden Paul Holden
            Peter Dias Peter Dias
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 15 minutes
                5h 15m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.