[XML export] export 7sus(4) chord to MusicXML fails reimport: "Element degree contains unknown attribute text."

• Apr 9, 2017 - 04:35
Reported version
2.1
Type
Functional
Severity
S4 - Minor
Status
closed
Project

Fatal error: line 88 column 24 Element degree contains unknown attribute text.

1. Open the following: G7sus.mscz
2. Export as MusicXML: ( G7sus.xml )
3. Import that .xml into MuseScore.

Result: Fatal error: line 88 column 24 Element degree contains unknown attribute text.

In the xml, the degree text="", which seems to be the problem?


Comments

Same error in 33f628051 from master branch
(390fb29 is from 2.1 branch and a couple days older than d2dda16 AKA 2.1-RC)

Ignoring the error leads to loss of that chord Symbol in master.

2.1-RC and 2.0.3 give the same error, but don't lose the chord symbol on 'load anyway', both show a "G7sus4", so add/append the "4".

Title export sus7 chord to MusicXML fails reimport: "Element degree contains unknown attribute text." [XML export] export sus7 chord to MusicXML fails reimport: "Element degree contains unknown attribute text."

It is not the empty text it stumbles accross, it is the entire text atribute it complains about.
degree-type and degree-value have an (optional) text attribute, degree itself has not. At least that is how I interprete the MusicXML Standard

Code in mscore/exportxmp.cpp, lines 5542-5559 , esp. note the comment:

// hack to correct text for suspended chords whose kind text has degree information baked in
// (required by some other applications)

So this seems to be needed by some other applications (which?), but does not get tolerated on import. I guess that if we want to keep that hack (do we really?), we'd need another hack for import and that one may need to circumvent the XML validator.

Thanks for clarifying. I should mention rarely do jazz musicians put write "G7sus4" and instead only write "G7sus" because is optimized for common case of sus4.

Title [XML export] export sus7 chord to MusicXML fails reimport: "Element degree contains unknown attribute text." [XML export] export 7sus(4) chord to MusicXML fails reimport: "Element degree contains unknown attribute text."

If you use the "Blame" option in github, you'll see why that code was added - to address #53936: Incomplete MusicXML text attributes for 7sus4 chords. FWIW,. I was never crazy about that hack. The program in question was something written by a MuseScore user - see https://musescore.org/en/node/51321. it appears we were already aware this solution was not OK, and I asked for more feedback, but made a typo in a link for the request. The actual thread is here: https://musescore.org/en/node/114771.

If I'm following the paper trail correctly, it hasn't ever worked completely correctly, but the fix is probably to change this: https://github.com/musescore/MuseScore/commit/6f6b912b697e61fea6a2ef571….

Still not at all clear to me what we should be doing exactly, though.

Thanks for sharing. I've skimmed quickly over that without studying carefully. It seems the last thing Michael Good says :

If you put the entire chord symbol text in the kind element, you must also set the text attribute on the degree elements to an empty string. Otherwise you will likely get degrees being appended to your kind symbol, and that will be the fault of the export, not the import.

And that seems to be why you changed that degree text to the empty string"". But looking at Michael's example , he has the degree-value's text attribute and the degree-type's text attribute equal to empty strings, but actually does not have a text attribute for the parent degree. So maybe you just had a misreading of when he wrote "degree elements" thinking that meant *the* degree element versus the elements *inside* the degree element (which is what I believe he meant).

Out of curiousity, if I import MuseScore's G7sus.xml into Finale NotePad 2012, I get error:

"XML error in file G7sus.xml at line 88: Attribute "text" must be declared for element type "degree"

If I completely remove the text attribute from degree from the xml file, or if I remove the text attribute from degree and instead put the empty text as attribute for degree-value and degree-type (attached here), then I'm able into import into NotePad as well as MuseScore. **

Anyway, so it seems that if setting degree text attribute to an empty string is what is causing the import on finale notepad and musescore to complain, so maybe should do what his example shows by having degree-value and degree-type get an empty string for text attribute instead of having a text attribute for the degree element.??? But again, I haven't studied all the issues involved...

**(although I'm making a note that NotePad import displays as "G 7" without the word sus, while MuseScore import changes the original G7sus into an explicit G7sus4 even though the kind text is only "7sus". As an aside, to me personally, I would consider the "kind" to be just "suspended" and not "suspended-fourth" if user hasn't explicitly specified it as "sus4" versus "sus2", even though sus4 is by far the most common and may have been the writer's intention...but again I haven't studied the code and specs, so I'm sure there is a valid motivation for storing it as "suspended-fourth"...but maybe musescore should just look at the text when importing so musescore gets identical import as export).

Marc, it seems you also realized you might have misinterpreted, as you wrote in https://musescore.org/en/node/114771#comment-516351

"But I think I might have misinterpreted Michael Good's advice - apparently he was actually suggesting a text attrtibute on the "degree-value" tag, not the "degree" tag. Does this seem reaosnable to people?"

Seems reasonable to me have the empty string as text attribute for "degree-value". (Would "degree-type" also have an empty string as text attribute, similar to Michael Good's example?)

When answering when to include text attribute and when not to,
Michael Good makes the distinction that :

With 9sus4 there is no 1-1 matching of text to semantics as represented by the children of the harmony element. So in this case you need text tags to guide the reading application

So even though the specs say the text attribute is not "Required" for degree-type or degree-value, however for chords that don't have 1-1 matching of text to semantics (like these sus chords), I think should make everything explicitly clear. Since we are already spelling out the degree in the text attribute string of the kind element for these sus chords, I say should also explicitly set empty string for both degree-type in addition to degree-value. That way some other program doesn't try to add some undesired degree-type text, thereby turning a "G7sus" into something meaningless like "G7susadd". Basically, it doesn't hurt to include the empty string, but it can only help.

I guess that PR will do it. But I find the name for the boolean "degreeText" confusing, because it doesn't reflect its meaning: if true it means write an empty string while if false it means don't write any text attribute at all. So, I think a better to name that boolean something along the lines of emptyStringDegreeText. In the future someone might want to extend that MusicXML export code to actually explicitly output non-empty strings if that boolean is false.