Moodle
  1. Moodle
  2. MDL-13157

Create a standard method of writing xml files

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: STABLE backlog
    • Component/s: Libraries
    • Labels:
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      566

      Description

      Currently we create xml files in a number of different places ( e.g. gradebook, database presets, backups, choices, xmldb) and we haven't got a standard solid way to do it. == bugs and inconsistencies

      We should probably come up with a standard method of writing xml files and covert all previous locations to use it.

        Issue Links

          Activity

          Dan Poltawski created issue -
          Dan Poltawski made changes -
          Field Original Value New Value
          Link This issue has a non-specific relationship to MDL-13088 [ MDL-13088 ]
          Dan Poltawski made changes -
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          Hide
          Penny Leach added a comment -

          Any examples of a good way you think? I need to add this for writing LEAP in the portfolio stuff.

          Show
          Penny Leach added a comment - Any examples of a good way you think? I need to add this for writing LEAP in the portfolio stuff.
          Hide
          Penny Leach added a comment -

          I kind of want to tear out the Mahara LEAP export into a LEAP writing library actually and then just use that in Moodle... it uses smarty at the moment, which I guess isn't an option.

          Show
          Penny Leach added a comment - I kind of want to tear out the Mahara LEAP export into a LEAP writing library actually and then just use that in Moodle... it uses smarty at the moment, which I guess isn't an option.
          Hide
          Sam Marshall added a comment -

          backuplib.php has functions full_tag, start_tag, end_tag, xml_safe_content or something.

          these are not appropriate for use elsewhere but could be the basis for a simple class. Making a stream-based XML-writer is not exactly rocket science - a nice class for it (so that it can do pretty-print and stuff, and throw errors if you write the close tags in the wrong order) should probably be under 100 lines.

          Also note in cases where a (php5) DOM representation already exists in memory then the DOMDocument::saveXML method should be used, regardless of any other stream-based writer implementation that might get done. however if you want to write in a stream way, it isn't efficient to construct an in-memory DOM first, so this may not be a good general approach.

          Show
          Sam Marshall added a comment - backuplib.php has functions full_tag, start_tag, end_tag, xml_safe_content or something. these are not appropriate for use elsewhere but could be the basis for a simple class. Making a stream-based XML-writer is not exactly rocket science - a nice class for it (so that it can do pretty-print and stuff, and throw errors if you write the close tags in the wrong order) should probably be under 100 lines. Also note in cases where a (php5) DOM representation already exists in memory then the DOMDocument::saveXML method should be used, regardless of any other stream-based writer implementation that might get done. however if you want to write in a stream way, it isn't efficient to construct an in-memory DOM first, so this may not be a good general approach.
          Martin Dougiamas made changes -
          Fix Version/s 2.0.1 [ 10420 ]
          Fix Version/s 2.0 [ 10122 ]
          Martin Dougiamas made changes -
          Fix Version/s STABLE backlog [ 10463 ]
          Fix Version/s 2.0.1 [ 10420 ]
          Hide
          Eloy Lafuente (stronk7) added a comment -

          NOTE: This issue was assigned to the STABLE backlog without complete triaging process. Marking it as triaged, but with this note for future reference.

          Show
          Eloy Lafuente (stronk7) added a comment - NOTE: This issue was assigned to the STABLE backlog without complete triaging process. Marking it as triaged, but with this note for future reference.
          Eloy Lafuente (stronk7) made changes -
          Labels triaged
          Martin Dougiamas made changes -
          Workflow jira [ 24544 ] MDL Workflow [ 42959 ]
          Martin Dougiamas made changes -
          Workflow MDL Workflow [ 42959 ] MDL Full Workflow [ 71366 ]
          Martin Dougiamas made changes -
          Assignee Martin Dougiamas [ dougiamas ] moodle.com [ moodle.com ]

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: