XML backup/export/import/edit tools

• Jan 6, 2019 - 03:08

In various feature requests and discussions, sophisticated users point out that some capabilities that can be achieved by extracting the XML from an .mcsz, backing it up, editing it with TextPad etc., and replacing it. It's not for the faint of heart, but doing this provides access to a range of operations that would be tedious or difficult via the MS UI.

Perhaps this has already been considered (I didn't find anything): Could we provide a more structured way to import/export/manipulate XML elements, eliminating some of the risk and tedium of doing this manually?

The ideal might be something along the lines of HTML editing modes in WYSIWYG editors, where we could actually make textual updates in place from within the UI, using a standard text editor window (which could presumably be assembled from open source components). Such an interface might also protect us, to some extent, from making dangerous changes.

Alternatively, it could be a help just to have some simple commands for doing backup/extract/replace/etc., especially if we could incorporate some primitive automatic versioning via file names/dates.

Perhaps as a next step it might also be possible to split/merge the XML elements (like HTML editors that only provide access to the body section), to protect the more "dangerous" parts versus the "safely editable" parts.

This is obviously not in the core mission of MuseScore, but perhaps it could streamline the operations of some power users, and lower the technical threshold a little for becoming a power user.


Comments

In reply to by Jojo-Schmitz

Naturally, but when this type of editing is done frequently/repetitively it might same some steps, particularly in terms of naming and version management. And it might make it easier for serious but less-tech-aware users to take advantage of the capability without having to worry about the "careful, only for power users" warning. But perhaps I'm only seeing edge cases where this would be helpful.

I doubt we will see this for the purpose of hacking with the MSCX, but we might see something like it for the purpose of providing an alternative representation of the musical data. We wouldn't provide a text viewer/editor (no point in doing that when others already exist) but instead the XML structure would be displayed in a tree view, like this:

score-as-tree-view.png

Inkscape has something similar for editing SVG files.

The tree view has an advantage over a raw text viewer in that there can be some content awareness. For example:

  • Replace XML escape codes (e.g. "&" in the MSCX displayed as "&" in the viewer)
  • Translation/localisation (e.g. "Measure" displayed as "Bar" for users in the UK)
  • More friendly syntax (e.g. "<note><pitch>60</pitch><tpc>21</tpc></note>" displayed as "C#4").

It would also mean that we can restrict the user's choice of what to enter to values that are actually valid. This means editing in the tree view could not corrupt the score, unlike in a text editor.

The main reason we might consider doing something like this would be for the benefit of blind users who rely on a screen reader to tell them what is happening on the screen. MuseScore's score view is not very accessible to screen readers, and I don't think it can ever be made fully accessible. However, a tree structure like this would be fully accessible right from the get-go, as we can rely on Qt's built-in accessibility features.

Another area that the tree view would be useful is for the score comparison tool, to show what has changed between two versions of a score.

score-tree-diff-view.png

Do you still have an unanswered question? Please log in first to post your question.