Are multiple tags valid on a single line in .MSCX files?

• Jun 6, 2021 - 18:39

Can I string multiple XML tags together or do I need to use a LF character?

e.g. would (Events)(Event)(len)1500(/len)(/Event)(/Events) be allowed.

(I know it should be angle brackets but they disappear when I post).


Comments

When in doubt, try it out!

I've just created a new score, saved it as mscx and closed it. Then removed all whitespace between tags and it reopened without any issues.

As a rule of thumb, anything valid XML goes.

MuseScore uses a QXmlStreamReader to read the files, even though it writes them manually as QTextStream hoping it doesn’t ever get the XML encoding wrong.

The manual writing causes consistent, if iffy, indentation (which I’ve made use of in my shell scripts) and ordering (which is a good thing). The reading as proper XML means anything you do editing the .mscx files with proper XML tools like XSLT will be understood.

In reply to by mirabilos

This consistent indentation is certainly a bit "iffy" but also very useful. My processing is in VBA plus a few formulas. It will be up to me to ensure that I produce valid XML so I'll just follow what I see in the MSCX files but sometimes without whitespace. I am not familiar with XSLT but it sounds intriguing.

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